CORBA 2.6.1 Programmer's Guide for Java
// If within an SSL session, obtain a pointer to the certificate chain.
if ( ssiop->SSL_session() )
{
SSLIOP::SSL_cert_var chain = ssliop->get_peer_certificate_chain();
// walk the cert chain and print the subject and issuer's DN
for (int i=0; i < chain->length(); i++)
{
CORBA::Octet *der_cert = chain[i];
// Use OpenSSL to parse the certificate.
// Convert to OpenSSL internal X509 format (DER to Internal X509)
X509 *peer_x509 = ::d2i_X509(0, &der_cert, cert->length() );
// Obtain the subject's DN.
char dn[256];
::X509_NAME_oneline( ::X509_get_subject_name(peer_x509), dn, sizeof(dn) );
cout << "Peer certificate subject DN is: " << dn;
::X509_NAME_oneline(::X509_get_issuer_name(peer_x509), dn, sizeof(dn) );
cout << " and the cert was issued by: " << dn << endl;
}
Chapter 10. Porting CORBA Applications to
NonStop
CORBA
Chapter 12. Developing Prototype Applications on
a
PC