TAO::SSLIOP::Current_Impl Class Reference

TSS portion of the TAO SSLIOP::Current extension, and the SSLIOP-specific SecurityLevel3::SecurityCurrent object. More...

#include <SSLIOP_Current_Impl.h>

Inheritance diagram for TAO::SSLIOP::Current_Impl:

Inheritance graph
[legend]
Collaboration diagram for TAO::SSLIOP::Current_Impl:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Current_Impl (void)
 Constructor.

 ~Current_Impl (void)
 Destructor.

void get_peer_certificate_chain (::SSLIOP::SSL_Cert *cert_chain)
void ssl (SSL *s)
 Set the pointer to the underlying SSL session state.

SSL * ssl (void)
 Return pointer to the SSL session state for the current upcall.


Public Attributes

virtual SecurityLevel3::ClientCredentials_ptr
virtual client_credentials(ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC((CORBA CORBA::Boolean
request_is_local(ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC((CORBA voi 
get_peer_certificate )(::SSLIOP::ASN_1_Cert *certificate)

Protected Member Functions

virtual CORBA::ULong tag (void) const
 Return the unique tag that identifies the concrete subclass.


Private Member Functions

 Current_Impl (const Current_Impl &)
void operator= (const Current_Impl &)

Private Attributes

SSL * ssl_
 The SSL session state corresponding to the current upcall.


Detailed Description

TSS portion of the TAO SSLIOP::Current extension, and the SSLIOP-specific SecurityLevel3::SecurityCurrent object.

This class encapsulates the thread-specific state of an SSL session during a given upcall.

Definition at line 45 of file SSLIOP_Current_Impl.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO::SSLIOP::Current_Impl::Current_Impl void   ) 
 

Constructor.

Definition at line 9 of file SSLIOP_Current_Impl.inl.

00010   : ssl_ (0)
00011 {
00012 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO::SSLIOP::Current_Impl::~Current_Impl void   ) 
 

Destructor.

Definition at line 24 of file SSLIOP_Current_Impl.cpp.

00025 {
00026 }

TAO::SSLIOP::Current_Impl::Current_Impl const Current_Impl  )  [private]
 

Prevent copying through the copy constructor and the assignment operator.


Member Function Documentation

void TAO::SSLIOP::Current_Impl::get_peer_certificate_chain ::SSLIOP::SSL_Cert cert_chain  ) 
 

Return the SSL peer certificate chain associated with the current request as a sequence of DER encoded certificates.

Definition at line 86 of file SSLIOP_Current_Impl.cpp.

References SSLIOP::SSL_Cert, and X509.

00088 {
00089   if (this->ssl_ == 0)
00090     return;
00091 
00092   STACK_OF (X509) *certs = ::SSL_get_peer_cert_chain (this->ssl_);
00093   if (certs == 0)
00094     return;
00095 
00096   const int chain_length = sk_X509_num (certs);
00097   cert_chain->length (chain_length);
00098 
00099   // Copy the peer certificate chain to the SSLIOP::SSL_Cert
00100   // sequence.
00101   for (int i = 0; i < chain_length; ++i)
00102     {
00103       // Extract the certificate from the OpenSSL X509 stack.
00104       ::X509 *x = sk_X509_value (certs, i);
00105 
00106       // Get the size of the ASN.1 encoding.
00107       const int cert_length = ::i2d_X509 (x, 0);
00108       if (cert_length <= 0)
00109         continue;  // @@ What do we do if there is an error?
00110 
00111       ::SSLIOP::ASN_1_Cert &certificate = (*cert_chain)[i];
00112       certificate.length (cert_length);
00113 
00114       CORBA::Octet *buffer = certificate.get_buffer ();
00115 
00116       // Convert from the internal X509 representation to the DER
00117       // encoding representation.
00118       (void) ::i2d_X509 (x, &buffer);
00119     }
00120 }

void TAO::SSLIOP::Current_Impl::operator= const Current_Impl  )  [private]
 

Prevent copying through the copy constructor and the assignment operator.

ACE_INLINE SSL * TAO::SSLIOP::Current_Impl::ssl void   ) 
 

Return pointer to the SSL session state for the current upcall.

Definition at line 21 of file SSLIOP_Current_Impl.inl.

00022 {
00023   return this->ssl_;
00024 }

ACE_INLINE void TAO::SSLIOP::Current_Impl::ssl SSL *  s  ) 
 

Set the pointer to the underlying SSL session state.

Definition at line 15 of file SSLIOP_Current_Impl.inl.

Referenced by TAO::SSLIOP::Connection_Handler::setup_ssl_state().

00016 {
00017   this->ssl_ = s;
00018 }

CORBA::ULong TAO::SSLIOP::Current_Impl::tag void   )  const [protected, virtual]
 

Return the unique tag that identifies the concrete subclass.

Definition at line 123 of file SSLIOP_Current_Impl.cpp.

00124 {
00125   return ::SSLIOP::TAG_SSL_SEC_TRANS;
00126 }


Member Data Documentation

void TAO::SSLIOP::Current_Impl::get_peer_certificate
 

Return the SSL peer certificate associated with the current request as an octet sequence, i.e. a DER encoded certificate.

Definition at line 61 of file SSLIOP_Current_Impl.cpp.

00063 {
00064   if (this->ssl_ == 0)
00065     return;
00066 
00067   TAO::SSLIOP::X509_var cert = ::SSL_get_peer_certificate (this->ssl_);
00068   if (cert.ptr () == 0)
00069     return;
00070 
00071   // Get the size of the ASN.1 encoding.
00072   const int cert_length = ::i2d_X509 (cert.in (), 0);
00073   if (cert_length <= 0)
00074     return;
00075 
00076   certificate->length (cert_length);
00077 
00078   CORBA::Octet *buffer = certificate->get_buffer ();
00079 
00080   // Convert from the internal X509 representation to the DER encoding
00081   // representation.
00082   (void) ::i2d_X509 (cert.in (), &buffer);
00083 }

SSL* TAO::SSLIOP::Current_Impl::ssl_ [private]
 

The SSL session state corresponding to the current upcall.

Definition at line 99 of file SSLIOP_Current_Impl.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:55:57 2006 for TAO_SSLIOP by doxygen 1.3.6