Post not yet marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliesup-voted.tooltip
Replied In
NSInternalInconsistencyException when trying to create signature using SecKeyCreateSignature
Hi, eskimo,Thanks for your reply.Yes, the eclipse curve private key is in the Secure Enclave.I query the SecKeyRef from the keychain (at line #11) and then use it to create the signature almost immediately (call signature at line #18). NSDictionary *query = @{
(__bridge id)kSecClass: (__bridge id)kSecClassKey,
(__bridge id)kSecAttrKeyClass: (__bridge id)kSecAttrKeyClassPrivate,
(__bridge id)kSecAttrLabel: index,
(__bridge id)kSecReturnRef: @YES,
(__bridge id)kSecUseOperationPrompt: promptStr
};
// Retrieve the key from the keychain.
SecKeyRef privateKey;
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, (CFTypeRef *)&privateKey);
NSData* dataToReturn = nil;
if (status == errSecSuccess)
{
*errorCodeBack = NO_ERROR;
dataToReturn = [self signature:inputData withKey:privateKey err:errorCodeBack];
CFRelease(privateKey);
}And the NSInternalInconsistencyException happened at line #4 when calling SecKeyCreateSignature.-(NSData*)signature:(NSData*)plainData withKey:(SecKeyRef)privateKey err:(UAF_ErrorCode*)errorCodeBack
{
NSError *error;
NSData *signature = CFBridgingRelease(SecKeyCreateSignature(privateKey, kSecKeyAlgorithmECDSASignatureMessageX962SHA256, (CFDataRef)plainData, (void *)&error));
if (error) {
//some error handling code...
return nil;
}
return signature;
} I review the latest crash log again, there are also 13.4.x users now (13.1.x - 13.4.x).All the crashes are on 13.x for now.I'll try to collect more information and file a bug about this.Many thanks.