Skip to content

How to represent Certificates in JSON

My first thought was to insert the PEM block as a JSON string. But the newlines in PEM are a problem in JSON.

  • Embed the certificate as JSON object with every field?
  • Use base46 encoding on the PEM block (PEM is base64 itself, but with additional header, footer ans line breaks)
  • ...?

As a hack, I put every line of the PEM block in an JSON string array. That's easy to consume by the program but will be super annoying when it comes to production / usage / creation / manipulation of the config files.

Edited by Jens Drenhaus