Frage

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).

War es hilfreich?

Lösung

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 */
}

Andere Tipps

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top