[openssl-users] SSL_set_verify with a context?

Ryan Pfeifle Ryan.Pfeifle at nice.com
Thu Oct 27 19:54:34 UTC 2016

You can use X509_STORE_CTX_get_app_data() and type-cast the returned pointer to SSL*.

Ryan Pfeifle
Software Engineer

VPI is now part of NICE<http://www.NICE.com>

Tel: 1.805.389.5200 x5297

E-mail: Ryan.Pfeifle at nice.com


The information transmitted in this message is intended only for the addressee and may contain confidential and/or privileged material. If you received this in error, please contact the sender and delete this material from any computer.

From: openssl-users [mailto:openssl-users-bounces at openssl.org] On Behalf Of Lei Kong
Sent: Thursday, October 27, 2016 11:54 AM
To: openssl-users at openssl.org
Subject: Re: [openssl-users] SSL_set_verify with a context?

I am using the following link ssl to my container structure, so is it possible to  get ssl from x509_ctx in verify_callback?
    SSL_set_app_data(ssl, this);

    int verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx);

From: Lei Kong <leikong at msn.com<mailto:leikong at msn.com>>
Sent: Thursday, October 27, 2016 1:24:05 AM
To: openssl-users at openssl.org<mailto:openssl-users at openssl.org>
Subject: SSL_set_verify with a context?

What I am trying to achieve is to allow some minor certificate chain validation errors, e.g. "CRL unavailable", based on my per-session configuration. I am think of using my verify callback to record the errors.

void SSL_set_verify(SSL *s, int mode, int (*verify_callback)(int, X509_STORE_CTX *));

int verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx);

Given the above interfaces, it seems I cannot set the callback with a context, which is needed to link a callback instance to my SSL session for error tracking. Yes, I can use SSL_get_verify_result to get the error afterwards, but is it guaranteed that the most severe error is always returned by SSL_get_verify_result? For example, I don't want "unable to get CRL" to mask other more important errors.

I would rather avoid repeating validating the whole chain manually after default validation is completed, is it possible to achieve my goal without repeating chain validation manually?

Any comment will be appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20161027/7f2e8440/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vpi_logo-sm.jpg
Type: image/jpeg
Size: 24783 bytes
Desc: vpi_logo-sm.jpg
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20161027/7f2e8440/attachment-0001.jpg>

More information about the openssl-users mailing list