yes, SecKey is valid. I have generate the KeyPair and then store it to Keychain.
Here is my Key retrieval code
let tag = "com.example.keys.mykey".data(using: .utf8)!
let getquery: [String: Any] = [kSecClass as String: kSecClassKey,
kSecAttrApplicationTag as String: tag,
kSecAttrKeyType as String: kSecAttrKeyTypeEC,
kSecReturnRef as String: true]
var item: CFTypeRef?
let status = SecItemCopyMatching(getquery as CFDictionary, &item)
guard status == errSecSuccess else { return nil }
if item == nil {
return nil
}
let key = item as! SecKey
I have printed signature, and didn't get any error
But my API provider guidelines is signature must be 80 length
Signature must be generated in IEEE P1363 format. If you generate
signatures in another format, such as the ASN.1 format, you must convert your signatures before sending