以下のコマンドから、最初の深度証明書に対してのみBase64ピンを生成できます。ただし、証明書のすべての深さに対してピンを生成する必要があります。
openssl s_client -servername example.com -connect example.com:443 -showcerts
| openssl x509 -pubkey -noout | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
3つではなく1つのキーのみを提供します
cUPcTAZWKaASuYWhhneDttWpY3oBAkE3h2+soZS7sWs=
では、どうすれば3つのレベルのピンすべてを生成できますか?
承認された回答:
私はRomeoにほとんど同意していますが、サーバーに証明書ファイルがすでにあるはずですが、 1つのs_client
からの複数の証明書を処理する必要があります 次のようなことができます:
openssl s_client ..... -showcerts
| awk '/-----BEGIN/{f="cert."(n++)} f{print>f} /-----END/{f=""}'
# or input from bundle or chain file
for c in cert.*; do
openssl x509 <$c -noout -pubkey .....
done
rm cert.*
# use better temp name/location if you want