openssl get certificate from SSL_CTX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want to get the client certificate and the CA certificates that I
set to SSL_CTX. Is there any sample code to do this ? I have not been
successful so far. I set the certificate and CA certs this way.

char* cacertFile = "cacert.crt";
char* certFile = "client.crt";
char* keyFile = "client.key";

if (!SSL_CTX_load_verify_locations(ctx, cacertFile, NULL)) {
    std::cout << "cannot load cacerts" << std::endl;
} else {
    std::cout << "cacert loaded" << std::endl;
}

if (!SSL_CTX_use_certificate_file(ctx, certFile, SSL_FILETYPE_PEM)) {
    std::cout << "cannot load certfile" << std::endl;
} else {
    std::cout << "certfile loaded" << std::endl;
}

if (!SSL_CTX_use_PrivateKey_file(ctx, keyFile, SSL_FILETYPE_PEM)) {
    std::cout << "cannot load private key" << std::endl;
} else {
    std::cout << "private key loaded" << std::endl;
}

Later I want to see what is the client cert and CA certs. I am looking
for any example code to do this.

Thanks.
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux