2012-05-08 102 views

回答

3

X509_verify_cert()本質上檢查證書的有效性。這包括驗證已簽名屬於CA的證書的簽名是否有效並且是日期 - 它會像那樣處理整個鏈。

但是,它並沒有驗證給定的RSA簽名是否有效 - 雖然它將RSA簽名驗證爲其工作的一部分,但它不是您應該使用的那樣做。

從廣義上講,就像瀏覽SSL站點時出現證書錯誤時運行的功能一樣。

2

API X509_verify_cert()根據在X509_store結構中設置的Verification標誌進行驗證。 有了這個API u能驗證證書
1.Expiry
2.Issuer(信任路徑)
2.1中間證書到期,
2.2中間證書信任鏈,
2.3中間證書撤銷,
3.Revocation對CRL
3.1 CRL在證書到期
3.2 CRL信任路徑
(注:驗證CRL u需要最少一個證書ATLEAST在store_ctx變量)
信任鏈的證書
5.Signature的4.Depth

標誌爲不同的驗證在x509_vfy.h文件被提及

 /* Send issuer+subject checks to verify_cb */ 
     #define X509_V_FLAG_CB_ISSUER_CHECK  0x1 
     /* Use check time instead of current time */ 
     #define X509_V_FLAG_USE_CHECK_TIME  0x2 
     /* Lookup CRLs */ 
     #define X509_V_FLAG_CRL_CHECK   0x4 
     /* Lookup CRLs for whole chain */ 
     #define X509_V_FLAG_CRL_CHECK_ALL  0x8 
     /* Ignore unhandled critical extensions */ 
     #define X509_V_FLAG_IGNORE_CRITICAL  0x10 
    /* Disable workarounds for broken certificates */ 
    #define X509_V_FLAG_X509_STRICT   0x20 
    /* Enable proxy certificate validation */ 
     #define X509_V_FLAG_ALLOW_PROXY_CERTS  0x40 
     /* Enable policy checking */ 
     #define X509_V_FLAG_POLICY_CHECK  0x80 
    /* Policy variable require-explicit-policy */ 
    #define X509_V_FLAG_EXPLICIT_POLICY  0x100 
    /* Policy variable inhibit-any-policy */ 
    #define X509_V_FLAG_INHIBIT_ANY   0x200 
    /* Policy variable inhibit-policy-mapping */ 
     #define X509_V_FLAG_INHIBIT_MAP   0x400 
    /* Notify callback that policy is OK */ 
    #define X509_V_FLAG_NOTIFY_POLICY  0x800 
    /* Extended CRL features such as indirect CRLs, alternate CRL signing keys */ 
    #define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000 
    /* Delt1a CRL support */ 
    #define X509_V_FLAG_USE_DELTAS   0x2000 
    /* Check selfsigned CA signature */ 
    #define X509_V_FLAG_CHECK_SS_SIGNATURE  0x4000