Openssl

“證書的 notBefore 欄位中的格式錯誤”,但 x509 -text 顯示有效的“NotBefore”

  • March 7, 2017

我正在為我的 VPN 配置更新證書。當我檢查有效性時:

openssl verify -CAfile keys/ca.crt -verbose keys/example.org.crt
C = XX, ST = XX, L = City, O = Example, OU = Manager, CN = example.org, name = EasyRSA, emailAddress = somemail
error 13 at 0 depth lookup: format error in certificate's notBefore field
error keys/example.org.crt: verification failed

但是用 x509 檢查顯示一個有效的 not before:

openssl x509 -in keys/example.org.crt -text Certificate:
   Data:
       Version: 3 (0x2)
       Serial Number: 6 (0x6)
   Signature Algorithm: sha512WithRSAEncryption
       Validity
           Not Before: Mar  4 00:00:00 2017
           Not After : Apr  1 00:00:00 2018

我發布了經過認證的以下tldp 指南

openssl ca -config openssl-1.0.0.cnf -extensions server -days 375 -notext -md sha512 -in keys/example.org.csr -out keys/example.org.crt -startdate 20170304000000 -enddate 20180401000000

當您確定開始/結束日期時,您也必須設置時區!這是一個有效的證書:

Certificate:
   Data:
       Version: 3 (0x2)
       [...]
           Not Before: Mar  5 03:01:35 2016 GMT
           Not After : Mar  5 03:01:35 2017 GMT

-start/enddate 選項應該被格式化YYMMDDHHMMSSZ,你的缺少最後的 Z。

引用自:https://unix.stackexchange.com/questions/349875