我正在使用树莓派创建一个测试网络。我的计算机将成为 CA,而我的 pi 零 W 将成为客户端。我在我的计算机上创建了一个自签名 CA 证书,在 pi 上创建了证书请求,并在我的计算机上使用 CA 密钥签署了请求。
当我在 pi 上验证证书时,出现错误。使用相同的命令和相同的文件在我的计算机上没有错误
树莓派错误:
$ openssl verify -verbose -CAfile ca.pem pi.pem
error 18 at 0 depth lookup: self signed certificate
error cert.pem: verification failed
# ca.pem is the ca self-signed cert. pi.pem is the cert signed by ca private key
在我的电脑上使用相同的文件:
$ openssl verify -verbose -CAfile ca.pem pi.pem
error cert.pem: verification failed
error 18 at 0 depth lookup: self signed certificate
OK
# ca.pem is the ca self-signed cert. pi.pem is the cert signed by ca private key
创建证书的过程:
# Server: https://support.symantec.com/en_US/article.TECH242030.html
openssl req -new -sha256 -out cert.csr
openssl x509 -req -days 365 -in cert.csr -signkey privkey.pem -sha256 -out cert.crt
openssl x509 -in cert.crt -out ca.pem -outform PEM
# Client:
openssl req -new -sha256 -out pi.csr
openssl x509 -req -days 365 -in pi.csr -signkey privkey.pem -sha256 -out pi.crt # <--- privkey.pem is the privkey of CA
openssl x509 -in pi.crt -out pi.pem -outform PEM
您的 CA 证书需要某种配置文件,否则它将使用basicConstraints=CA:FALSE
这意味着它创建一个自签名叶证书而不是 CA 证书。换句话说,您的证书是可信的,但不能用于签署其他证书。
参见例如此处如何创建链。
https://gist.github.com/Soarez/9688998
请注意,您还需要使用 eg -CA
,-CAkey
因此请不要使用您自己的命令而仅使用配置文件。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句