Posts

Post marked as solved
15 Replies
8.1k Views
First of all, sorry for my english.i want iOS mutual authentication with client certificate.but when i make NSURLCredential for NSURLAuthenticationMethodClientCertificate,i have to need SecIdentityRef. but i cannot obtain identity from anywhere..1.i created keypair with SecKeyGeneratePair (RSA, 2048). and stored into keychain.2.send publickey to server. and get PEM type certificate (base64) from server, correctly.3.i decoded it. and make certificate with SecCertificateCreateWithData,store it keychain directlyNSDictionary* certDic = @{ (__bridge id)kSecClass : (__bridge id)kSecClassCertificate, (__bridge id)kSecAttrAccessible : (__bridge id)kSecAttrAccessibleWhenUnlockedThisDeviceOnly, (__bridge id)kSecValueRef : (__bridge id)savedCertRef, (__bridge id)kSecAttrLabel : cert_tag, }; OSStatus status = SecItemAdd((__bridge CFDictionaryRef)certDic, NULL);perfectly work until here.4.now my keychain stored "Private Key", "Public Key","Certificate" from server5.when i try to access server, server request client certificate.so i have to send client certificate from my keychainbut i have only SecCertificateRef. at that time. there is no SecIdentityRef//in NSURLAuthenticationMethodClientCertificate block... SecCertificateRef certificate = [DeviceCertificateControl getDeviceCertRef]; SecIdentityRef identity = ??????????????????; NSArray *certArray = [NSArray arrayWithObject:(__bridge id)certificate]; * credential = [NSURLCredential credentialWithIdentity:identity certificates:certArray persistence:NSURLCredentialPersistencePermanent];:::::::::: question.1. how to make SecIdentityRef with SecCertificateRef with private key ref?(many other examples, they use P12 file (pkcs#12), but i don't use it)2. can i make pkcs#12 type data directly in iOS device?3. is there way to send certification without identity?many thanks.
Posted
by mo.o.
Last updated
.