Unable to store public certificate on NitroKey pro

Hello,

I’m trying to store CA signed certificate on my NitroKey Pro. I’m getting errors from both GnuPG and OpenSC when trying to write certificate to card.

Using “gpg2 --edit-card”, command writecertificate 3 < mycert.der
gpg fails with error
gpg: error writing certificate to card: Provided object is too large

Using “pkcs15-init --store-certificate mycert.pem --id 3”
OpenSC fails with error
Failed to store certificate: Transmit failed

The space is limited and it looks like your certificate is too large. In order to debug this issue, could you retry with a smaller certificate?

How much space in on the card? Is there a way to know how much space is available for the certificate?

The certificate can be up to 2 kbyte.

Thanks for the info. I found my problem was that I was storing the certificate in PEM format, which is larger in size than DER format. I was able to put certificate to NitroKey using gpg writecert when using DER format.