Posts

Post not yet marked as solved
3 Replies
427 Views
Hello, I created A ECC key in Secure Enclave. Then, when I tried to use SecItemCopyMatching to read the private key, it takes more than 8 seconds to read it on an iphoneX 14.6 device. However, other phones, with the same model and same IOS version,  do not have this phenomenon. Only this particular phone. Please advise the possible issue that causes this problem. Thank you. Below is my code: +(NSDictionary*)privateKeyQuery:(NSString*)labeled {     return @{              (__bridge id)kSecClass:(__bridge id)kSecClassKey,              (__bridge id)kSecAttrKeyClass:(__bridge id)kSecAttrKeyClassPrivate,              (__bridge id)kSecAttrLabel:labeled,              (__bridge id)kSecReturnRef:(__bridge id)kCFBooleanTrue              }; } +(SecKeyRef)getKey:(NSDictionary*)query {     CFTypeRef raw=nil;     OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &raw);     if (status == errSecSuccess && raw)     {         return (__bridge SecKeyRef)(CFBridgingRelease(raw));     }     else{                  SELog(@"IO- Could not get key for status=%@",@(status));                  return nil;     } } +(PublicKey*)getPublicKey:(NSString*)labeled {     NSDictionary *query=[self privateKeyQuery:labeled];     SecKeyRef underlying=[self getKey:query];     if (underlying) {         if (@available(iOS 10.3, *)) {             SecKeyRef publickeyRef=SecKeyCopyPublicKey(underlying);             if (publickeyRef) {                 return [[PublicKey alloc] initWithUnderlying:(__bridge SecKeyRef)(CFBridgingRelease(publickeyRef))];             }             else             {                 return nil;             }         } else {             // Fallback on earlier versions             return nil;         }     }     else     {         return nil;     } }
Posted
by iDGate.
Last updated
.
Post not yet marked as solved
2 Replies
734 Views
Hi friendsi want to use secure enclave to iPad mini2(ios 10.2.1)ex: CFErrorRef err=nil; CFDataRef result = SecKeyCreateDecryptedData(privateKey.m_underlying,kSecKeyAlgorithmECIESEncryptionStandardX963SHA256AESGCM, (__bridge CFDataRef)digest, &err);but i got errError Domain=NSOSStatusErrorDomain Code=-50 "algid:encrypt:ECIES:ECDH:KDFX963:SHA256:AESGCM: algorithm not supported by the key <SecKeyRef:('com.apple.setoken') 0x1740aa6e0>" UserInfo={NSDescription=algid:encrypt:ECIES:ECDH:KDFX963:SHA256:AESGCM: algorithm not supported by the key <SecKeyRef:('com.apple.setoken') 0x1740aa6e0>}my question is kSecKeyAlgorithmECIESEncryptionStandardX963SHA256AESGCM only for ios 10.3? for SecKeyCreateDecryptedData?
Posted
by iDGate.
Last updated
.