How to verify a X509 certificate in C

前端 未结 3 571
伪装坚强ぢ
伪装坚强ぢ 2021-01-31 23:17

I have a certificate in X509 format. this a input parameters in a function. What I would like to do is to verify the validity of the certificate. How can it be done?

         


        
3条回答
  •  不知归路
    2021-01-31 23:53

    See the documentation here.

    You need to create a certificate store using X509_STORE_CTX_new. Then add certificate chain using X509_STORE_CTX_set_chain. Add trusted root certificate using X509_STORE_CTX_trusted_stack. Finally add certificate to be verified using X509_STORE_CTX_set_cert.

    After that call X509_verify_cert.

    I hope this will help you to start on this.

提交回复
热议问题