SSL Certificate to JSON SSL Certificate to JSON unix unix

SSL Certificate to JSON


The problem was indeed related to the white spaces and line brakes.

Here is what worked for me:

  1. Copied the certificate into a one line text field. Not very elegant but it's a quick way to make a one line string out of it. Most text editors can do that, too i guess.

  2. Replaced the line brakes (now white spaces) with "\n". Do not replace the white spaces between those phrases -----BEGIN RSA PRIVATE KEY----- they can stay as they are.

Example:

{"key": "-----BEGIN RSA PRIVATE KEY-----\njlQvt9WdR9Vpg3WQT5+C3HU17bUOwvhp/r0+viMcBUCRW85UqI2BJJKTi1IwQQ4c\ntyTrhYJYOP+A6JXt5BzDzZy/B7tjEMDBosPiwH2m4MaP+6wTbi1qR1pFDL3fXYDr\n"}


Another way is to base64 encode the certificate at client and decode it on server. This avoids all the hassle of adding line breaks yet preserving the formatting,similar to kubernetes secrets