New ctrl to set current certificate.
[openssl.git] / demos / bio / server-arg.c
index be35e62..0d432a4 100644 (file)
@@ -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);