SSL证书转JSON [英] SSL Certificate to JSON

查看:226
本文介绍了SSL证书转JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过JSON将SSL证书作为字符串发送到我的服务器。在服务器上,我需要将JSON字符串重构为有效证书。我的问题是证书中的空格和行制动器。

I need to send a SSL Certificate as a string via JSON to my server. On the server I need to reconstruct the JSON string to a valid certificate. My problems are the spaces and line brakes in the certificate.

如何保存证书的正确格式?

How can I preserve the correct format of the certificate?

推荐答案

问题确实与空白和行制动器有关。

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

这对我有用:


  1. 将证书复制到一行文本字段中。虽然不是很优雅,但这是从中制作一行字符串的快速方法。我猜大多数文本编辑器也可以做到这一点。

  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.

将行制动器(现在为空白)替换为 \n。不要替换这些短语 ----- BEGIN RSA PRIVATE KEY ----- 之间的空格,它们可以保持原样。

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.

示例:

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

这篇关于SSL证书转JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆