如标题所述。我的控制台输出在运行时给了我一些虚假的值。主要问题是我的sumArray函数。它吐出一个看起来像一个内存位置的数字,而不是像我需要的那样返回总值。对于c ++还是比较新的,不确定我是否正确使用函数。请帮忙!
const access: any = SecAccessControlCreateWithFlags(
kCFAllocatorDefault,
kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
SecAccessControlCreateFlags.kSecAccessControlPrivateKeyUsage,
new interop.Pointer(0)
);
const myTag: NSData = NSString.alloc().initWithString("com.example.keys.mykey")
.dataUsingEncoding(NSUTF8StringEncoding);
// Will be marshalled into the necessary NSDictionary<any, any> type
const attributes: any = {
kSecAttrKeyType: kSecAttrKeyTypeECSECPrimeRandom,
kSecAttrKeySizeInBits: 256,
kSecAttrTokenID: kSecAttrTokenIDSecureEnclave,
kSecPrivateKeyAttrs: {
kSecAttrIsPermanent: true, // Hopefully marshalls to "YES" if appropriate
kSecAttrApplicationTag: myTag,
kSecAttrAccessControl: access,
},
};
const privateKey: any = SecKeyCreateRandomKey(attributes, new interop.Pointer(0));
console.info(privateKey);