我想创建自己的根证书颁发机构。
这里有一种生成自签名根密钥/证书的方法。
openssl req -x509 -nodes -newkey rsa:2048 -subj /CN=$1/countryName=UK/stateOrProvinceName=UK/organizationName=Me -keyout $1.key.pem -out $1.cert.pem
And here's another.
openssl genrsa -des3 -out $1.key.pem 2048
openssl req -new -subj /CN=$1/countryName=UK/stateOrProvinceName=UK/organizationName=Me -key $1.key.pem -out $1.csr
openssl x509 -req -days 36500 -in $1.csr -signkey $1.key.pem -out $1.crt.pem
如果我使用第一个证书创建客户端和服务器连接(使用QSslSocket),那么连接就会成功。问题是证书上的日期为1975年,我无法用它来签署其他证书。
我构建了第二种方法来生成一个有效日期的根证书,但SSL套接字连接失败,并显示“未知”错误,没有其他线索。我检查了客户端和服务器上正在使用正确的证书。
我做错了什么?谢谢。