how to get the Keyusage value from the X509 certificate?

后端 未结 3 1075
日久生厌
日久生厌 2020-12-21 14:22

I want to retrieve the Key usage value from the X509 structured certificate , i tried the following code

 X509* lcert=NULL;
 lCert=PEM_read(filename); // fun         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-21 15:00

    From ssl\ssl_lib.c, line 2365, OpenSSL v 1.0.2d:

    /* This call populates extension flags (ex_flags) */
    
    X509_check_purpose(x, -1, 0);
    

    So OpenSSL developers use this way.

    If digging deeper, you may find call of x509v3_cache_extensions, that populate flags, guarded by locks.

提交回复
热议问题