Ssl 读取X.509密钥或证书文件时出错:在Curl请求中发送证书时解析出错
我使用openssl使用以下命令生成自签名证书Ssl 读取X.509密钥或证书文件时出错:在Curl请求中发送证书时解析出错,ssl,curl,certificate,x509,Ssl,Curl,Certificate,X509,我使用openssl使用以下命令生成自签名证书 openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365ls 我用curl命令发送这个cert.pem curl --header 'Accept: application/json' --header 'Authorization: Bearer 043473b9-5cf4-3dcc-b7a6-32813f6e4df2' 'https://localho
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365ls
我用curl命令发送这个cert.pem
curl --header 'Accept: application/json' --header 'Authorization: Bearer 043473b9-5cf4-3dcc-b7a6-32813f6e4df2' 'https://localhost:8243/pizzashack/1.0.0/menu' --cert cert.pem --key key.pem -k -v
但此操作失败,错误为:读取X.509密钥或证书文件时出错:在Curl请求中发送证书时解析时出错
如何克服这个问题?这里有一个解决方案。当curl无法解密默认加密的my key.pem文件时,会发生这种情况。我们可以在生成证书时使用-nodes指令来避免加密密钥 根据以下请求生成的证书工作正常
openssl req -newkey rsa:2048 -x509 -keyout pii_key.pem -out piisp.pem -days 3650 -nodes