der2pem

der2pem is a trivial program to convert binary x509 certificates into printable base64 certificates in PEM format.  You might want to do this to convert an SSL or TLS certificate generated by OpenSSL.

The output of this program is of the form:

-----BEGIN CERTIFICATE-----
PWFJLr7oSkjritadf1QBLyWEbX0ab7lVG6/k1zd5KZ2vFkJoh9JuypCfQU/614+T
yYiuXCPSdLBTZ4t8WHFrITfDqonar6x3ZWq+cPLyCN8u2rPC6rfiJhRXNA4e03G0
bqhrJEeDhaVxcvlSFbajK/ohSST2Ki0X7tf/BejOkRrI6AsV/nV6Oe400QiNLLg8
PbY4P/PTWsbrqCsiZD7SwBkF/85JZhhFR1ojFaViGuaJi1tsF+4OEFwRQtEoU8NW
iI/GDz0GUW4=
-----END CERTIFICATE-----

where the gobbldegook is the base64 encoding of whatever the input to the program was.  No checks are made to determine if the input is really a DER format certificate or binary data at all.

The program is written in pure c89 (ANSI C), and has no dependencies on any libraries other than the c library.

To install this program on a typical Gnu/Linux system, you might use the two commands:

wget http://www.purposeful.co.uk/software/der2pem/der2pem.c
sudo gcc -O2 -o /usr/local/bin/der2pem der2pem.c

To use this program you might run a command like:

der2pem cert.der cert.pem

Alternatively you can use the standard input and output streams by specifying the special filename -

This is truly free software.