New ctrl to set current certificate.
New ctrl sets current certificate based on certain criteria. Currently two options: set the first valid certificate as current and set the next valid certificate as current. Using these an application can iterate over all certificates in an SSL_CTX or SSL structure.
This commit is contained in:
@@ -82,7 +82,24 @@ int main(int argc, char *argv[])
|
||||
ERR_print_errors_fp(stderr);
|
||||
goto err;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Demo of how to iterate over all certificates in an SSL_CTX
|
||||
* structure.
|
||||
*/
|
||||
{
|
||||
X509 *x;
|
||||
int rv;
|
||||
rv = SSL_CTX_set_current_cert(ctx, SSL_CERT_SET_FIRST);
|
||||
while (rv)
|
||||
{
|
||||
X509 *x = SSL_CTX_get0_certificate(ctx);
|
||||
X509_NAME_print_ex_fp(stdout, X509_get_subject_name(x), 0, XN_FLAG_ONELINE);
|
||||
printf("\n");
|
||||
rv = SSL_CTX_set_current_cert(ctx, SSL_CERT_SET_NEXT);
|
||||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
/* Setup server side SSL bio */
|
||||
ssl_bio=BIO_new_ssl(ctx,0);
|
||||
|
||||
|
Reference in New Issue
Block a user