For signing emails, I requested an S/MIME certificate using the German academic DFN service. AT the end of this process, I get a .p12 file (PKCS12). I can convert this file to PEM using
openssl pkcs12 -in TorstenBronger.p12 -nodes -out /tmp/temp.pem
In the PEM file, I can see four certificates (my own and the chain) and the private key. But importing the .p12 file into gpgsm fails:
$ gpgsm --import TorstenBronger.p12
gpgsm: data error at "data.objectidentifier", offset 67
gpgsm: error at "bag-sequence", offset 49
gpgsm: error parsing or decrypting the PKCS#12 file
gpgsm: total number processed: 0
It does not matter whether or not I removed the password from the key using the roundtripping described in https://serverfault.com/a/633820/47303.
Writing only the certificates to a PEM, I seem to be able to import them into gnupgsm’s database. But the key is missing.
How can I successfully import the certificates and the key into gnupgsm?