[openssl-users] convert from PEM to DER format or vice versa

Jakob Bohm jb-openssl at wisemo.com
Mon Dec 12 15:31:37 UTC 2016

On 12/12/2016 10:37, Sairam Rangaswamy -X (sairanga - ARICENT 
> As I understand, the X509 certificates from CA or self-signed can be 
> created in either
> PEM or DER format.
> Is there a way to programmatically convert the PEM format file to DER 
> or DER to PEM?
> Is there a single API or set of APIs available from openssl libraries?
It's simple Base64 conversion.  The PEM file is the DER file
Base64 encoded and decorated with 4 fixed lines that mark it
as a certificate (two blank lines and two lines with a lot
of dashes).

No need to use the i2d_X509/d2i_X509 functions that convert to and
from an internal OpenSSL data structure


Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded

More information about the openssl-users mailing list