PEM to DER Converter API
Convert PEM to DER (as Base64 or hex, with an optional ASN.1 structure dump), or wrap Base64/hex DER in PEM armour with a detected or chosen label.
POST /api/v1/tools/pem-der-converterMCP pem_der_converterSecurity & PrivacyConvert PEM to binary DER and back, extract the Base64 body, split PEM bundles, detect the block type and inspect the ASN.1 structure. Runs in your browser.
Input
Send these as a JSON object. Unknown fields are rejected.
- input
- pem-to-der: one or more PEM blocks. der-to-pem: the DER bytes as Base64 or hex. (string, up to 100000 characters, required)
- direction
- Which way to convert. (string, one of pem-to-der, der-to-pem, default "pem-to-der")
- label
- der-to-pem: the PEM label, or auto to detect it from the structure. (string, one of auto, CERTIFICATE, CERTIFICATE REQUEST, PUBLIC KEY, PRIVATE KEY, ENCRYPTED PRIVATE KEY, RSA PRIVATE KEY, RSA PUBLIC KEY, EC PRIVATE KEY, X509 CRL, PKCS7, default "auto")
- tree
- pem-to-der: include an ASN.1 structure dump (like openssl asn1parse) of each block. (boolean, default false)
curl https://pithlab.com/api/v1/tools/pem-der-converter \n -H "Authorization: Bearer $PITHLAB_KEY" \n -H "Content-Type: application/json" \n -d '{"input":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWIxfVoyp0KgIZ3n+X+yyE91ZT/rm\npCkycrF/J+R5JFfYL0+3tnlR9wE9ZyHH1jQhY6vkSOw0wd/aUHga4HN3/g==\n-----END PUBLIC KEY-----\n","direction":"pem-to-der"}'Example response
{
"ok": true,
"result": {
"blocks": [
{
"label": "PUBLIC KEY",
"description": "Public key (SubjectPublicKeyInfo)",
"bytes": 91,
"base64": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWIxfVoyp0KgIZ3n+X+yyE91ZT/rmpCkycrF/J+R5JFfYL0+3tnlR9wE9ZyHH1jQhY6vkSOw0wd/aUHga4HN3/g==",
"hex": "3059301306072a8648ce3d020106082a8648ce3d03010703420004588c5f568ca9d0a8086779fe5fecb213dd594ffae6a4293272b17f27e4792457d82f4fb7b67951f7013d6721c7d6342163abe448ec34c1dfda50781ae07377fe",
"isPrivate": false
}
]
}
}