1. 程式人生 > >獲取SSL證書的指紋

獲取SSL證書的指紋

ssl certificate openssl fingerprint certutil

每一張SSL證書都有指紋(fingerprint)信息,若要獲取,可以通過openssl或者certutil工具,分別在非Windows和Windows平臺下使用


基本語法:

openssl x509 -fingerprint -in cerfile.crt

若是報無法讀取文件,那麽極有可能是未指定格式,可嘗試如下

openssl x509 -fingerprint -in cerfile.crt -inform PEM
openssl x509 -fingerprint -in cerfile.crt -inform DER

若是需要指定顯示SHA1或者SHA256算法編碼的指紋信息,則追加參數

openssl x509 -fingerprint -sha1 -in cerfile.crt
openssl x509 -fingerprint -sha256 -in cerfile.crt



呃,Windows下面的certutil好像不能單獨輸出某一項,只能全部信息一起輸出

certutil -dump certfile.crt

嗯,certutil -dump輸出尾巴部分的 “證書哈希(md5):” 和 “證書哈希(sha1):” 就是指紋信息啦


獲取SSL證書的指紋