Convert ASC to P12

Specifically, I am trying to take an OpenPGP certificate created in & exported from Thunderbird (Win) and share it with a iOS email client app that requires it to be in a p12 format. The Thunderbird exported file is instead an ASC extension.

How do I convert it? I am seeing some dated references that seem to no longer apply to various apps like Kleopatra (Win) on the topic. I am unable to get Kleopatra to “export” it for example in any other format. A P12 format is NOT offered upon hitting export.

Personal / Home Use
Windows 11 Home 23H2
iOS 18.1.1 / iPhone

Hi @fafadgha, if the key is a RSA key you could just rename the filename and replace .asc with .p12 and try to import it in the email client. If they didn’t change anything in the mean time Apple uses RSA for their p12 certificates.

cklassen, thank you for the speedy response.

My first attempt got an error but I feel like it may just be manually copying and pasting the parts of the files that have public and private labels into a single file???

Just to be sure we’re on the same page. The files in question from Thunderbird (win) are backed up as certificates in ASC format. The public key backup doesn’t ask for a password but the secret key does when “backed up”.

My second attempt got an error too with a combined P12 file looking like:

-----BEGIN PGP PUBLIC KEY BLOCK-----

BLAH

-----END PGP PUBLIC KEY BLOCK-----

-----BEGIN PGP PRIVATE KEY BLOCK-----

BLAH

-----END PGP PRIVATE KEY BLOCK-----

As far as the Apple RSA requirement is concerned:

Thunderbird (win) default creation with OpenPGP was RSA and I went with RSA 4096

Sorry, I didn’t read the part about two keys in the same file. I did some research and tried to find something that could help. There is one instruction to convert a key into a P12 certificate but

  • you can see that a little bit more than just copying the contents of the two keys into one file is necessary to create a P12 certificate (Apple uses their own solution to save the keys)
  • OpenSSH is used in the process (I don’t know if you can just use a OpenPGP key instead of creating a key with OpenSSH)
  • it might be that this even doesn’t work because the guide is 8 years old

Yeah I read some guides that are like 12+ years old at this point. My last go with p12 files was importing them for use with OpenVPN on iOS probably that many years ago.

Then it was combining the separate keys in the same way. It could be some small syntax I’m missing too like headers of private / public and/or if the certificates need personal info like email address or other details.

'.p12` files are usually not used for OpenPGP key information. They usually are used with key material for use with the cryptographic message standard (CMS). See PKCS 12 - Wikipedia

So which iOS email client are you trying to get your OpenPGP key into? Can you point us to the documentation of its OpenPGP capabilities.

I am starting to suspect that the iOS client cannot deal with OpenPGP. In that case you cannot convert an OpenPG key into a CMS key.