Given a SecKey, is there any way to infer its type (e.g. whether it is kSecAttrKeyTypeRSA or kSecAttrKeyTypeEC)?
I see SecKeyGetTypeID(), but it is unclear to me what key object this function operates on as it accepts no parameters.
Given a SecKey, is there any way to infer its type (e.g. whether it is kSecAttrKeyTypeRSA or kSecAttrKeyTypeEC)?
I see SecKeyGetTypeID(), but it is unclear to me what key object this function operates on as it accepts no parameters.
Copyright © 2021 Jogjafile Inc.
You can retrieve the
kSecAttrKeyTypefrom the key and check if it iskSecAttrKeyTypeRSA(orkSecAttrKeyTypeEC). Example (taken from SwiftyRSA):