hello, Im trying to use ClientCertificate at iOS app.
First,I get PKCF#12 from web
Second, I get SecIdentity using SecPKCF12import to store identity, And It's Success(get "0" in "status" and get SecIdentity in "identity")
let options = [kSecImportExportPassphrase as String: password]
let status = SecPKCS12Import(data!, options as CFDictionary, &rawItems)
let identity = items[0][kSecImportItemIdentity as String] as! SecIdentity
Then, store identity in keychain,and its Success(get "0" in "status" )
query = [
kSecClass as String:kSecClassIdentity,
kSecValueRef as String:identity,
kSecAttrLabel as String:"1234567890" as AnyObject
]
let status = SecItemAdd(query as CFDictionary, nil)
After that, I tried to get SecIdentity from keychain,but its Fail(get "-25300" in "status" )
query = [
kSecClass as String:kSecClassIdentity,
kSecReturnRef as String:true as AnyObject,
kSecAttrLabel as String:"1234567890" as AnyObject,
kSecMatchLimit as String:kSecMatchLimitAll
]
var result:AnyObject? = nil
let status = SecItemCopyMatching(query as CFDictionary, &result)
Why?
Should I need to do something more?
Sorry for showing only a part of source code.
please give me advice..