2017-02-08 66 views
0

我試圖使用pyOpenSSL庫版本0.13pyOpenSSL X509擴展語法錯誤,同時增加authorityInfoAccess(AuthorityInfoAccessSyntax)

運行authorityInfoAccess擴展添加到X509證書

import OpenSSL 
url = 'URI:https://localhost:12345' 
ext = OpenSSL.crypto.X509Extension('authorityInfoAccess', 0, url) 
cert.add_extensions([ext]) 

錯誤

('X509 V3 routines', 'V2I_AUTHORITY_INFO_ACCESS', 'invalid syntax') 
('X509 V3 routines', 'X509V3_EXT_nconf', 'error in extension') 

所以我嘗試了各種語法我的分機(也不行):

'authorityInfoAccess:1.3.6.1.5.5.7.1.1;URI:https://localhost:12345' 

回答

0

在單證環顧四周後,我結束了進入OpenSSL的文檔: https://www.openssl.org/docs/man1.0.1/apps/x509v3_config.html

而且我發現它是如此簡單:

'caIssuers;URI:https://localhost:12345' 

在擴展的結果是以下內容:

X509v3 extensions: 
    X509v3 Basic Constraints: critical 
     CA:TRUE 
    X509v3 Subject Alternative Name: 
     URI:urn:publicid:IDN+myCA:loic_baron+authority+sa, URI:urn:uuid:25f08be1-f79e-3572-b8ee-610344119bc9, email:[email protected] 
    Authority Information Access: 
     CA Issuers - URI:https://localhost:12345