SSL certificate for JSON

I need to send an SSL certificate as a string via JSON to my server. On the server, I need to recover the JSON string in a valid certificate. My problems are gaps and line brakes in the certificate.

How to keep the correct format of the certificate?

+3


source to share


1 answer


The problem was really with gaps and line brakes.

Here's what worked for me:

  • Copied the certificate into one line text box. Not very elegant, but it's a quick way to make one line out of it. Most text editors can do this, I think too.

  • Replaced line brakes (now white spaces) with "\ n". Do not replace white spaces between these phrases -----BEGIN RSA PRIVATE KEY-----

    , they may remain as they are.



Example:

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

      

+5


source







All Articles