We need to transport an X.509 certificate via a QR code (or any 2D barcode, at this point, though not even PDF-417 seems to be able to store large enough amounts of data). At the moment, we write the certificate as a PEM encoding (which is a base64-encoded string representation of an X.509 certificate in DER format, plus opening and ending tags) into the QR code. The problem we face is that the resulting string is far too long.
While we could strip the opening and ending tags, this would not make much of a difference, which is why I took to the Interwebs to find a way to compress our certificate.
As it turns out, DER is only one possible encoding. According to Wikipedia, there is also PER (with variants UPER and APER). I downloaded a few samples, and it seems that we could save about 40-45% of bytes, provided the reader of the certificate knows the ASN.1 schema (we could manage this in our case). This would be enough to make a QR Code scannable again.
However, I cannot find a way to convert DER to PER. Does anybody know how this can be done?
Or has anyone a better idea how we could transport the X.509 certificate to the phone of a user without offering them at a central repository?