문제

I know there is SecPKCS12Import API to import(parse) PKCS12.

How to create PKCS12 from SecIdentityRef + SecCertificateRef?

I am looking for a way to use native API (Secure framework) rather than integrating OpenSSL (or other 3rd party library).

도움이 되었습니까?

해결책

You're looking for SecItemExport.

CFDataRef exportedData;
OSStatus ret = SecItemExport(arrayWithIdentityAndCert,
                             kSecFormatPKCS12,
                             0, /* Use kSecItemPemArmour to add PEM armor */
                             NULL,
                             &exportedData);

if(ret == errSecSuccess)
{
  /* exportedData now contains your PKCS12 data */
}

다른 팁

Also, there is API SecKeychainItemExport, which is used internally by SecItemExport.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top