SSLIOP_Credentials.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   SSLIOP_Credentials.h
00006  *
00007  *  $Id: SSLIOP_Credentials.h 77001 2007-02-12 07:54:49Z johnnyw $
00008  *
00009  *  @author Ossama Othman <ossama@dre.vanderbilt.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_SSLIOP_CREDENTIALS_H
00014 #define TAO_SSLIOP_CREDENTIALS_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "orbsvcs/SSLIOP/SSLIOP_Export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 #pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "orbsvcs/SSLIOP/SSLIOP_X509.h"
00025 #include "orbsvcs/SSLIOP/SSLIOP_EVP_PKEY.h"
00026 #include "orbsvcs/SecurityLevel3C.h"
00027 #include "tao/LocalObject.h"
00028 
00029 
00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00031 
00032 namespace TAO
00033 {
00034   class SSLIOP_Credentials;
00035 
00036    namespace SSLIOP
00037    {
00038      typedef SSLIOP_Credentials* Credentials_ptr;
00039      typedef TAO_Pseudo_Var_T<SSLIOP_Credentials> Credentials_var;
00040      typedef TAO_Pseudo_Out_T<SSLIOP_Credentials> Credentials_out;
00041    }
00042 
00043     /**
00044      * @class SSLIOP_Credentials
00045      *
00046      * @brief SSLIOP-specific implementation of the
00047      *        SecurityLevel3::Credentials interface.
00048      *
00049      * This class encapsulates the X.509 certificate associated with a
00050      * given a principal.
00051      *
00052      * @note Why is this class not the TAO::SSLIOP namespace?  Because
00053      *       brain damaged MSVC++ 6 cannot call a base class
00054      *       constructor of class declared in a namespace that is more
00055      *       than one level deep in a sub-class base member
00056      *       initializer list.
00057      */
00058     class TAO_SSLIOP_Export SSLIOP_Credentials
00059       : public virtual SecurityLevel3::Credentials,
00060         public virtual TAO_Local_RefCounted_Object
00061     {
00062     public:
00063       typedef SSLIOP::Credentials_ptr _ptr_type;
00064       typedef SSLIOP::Credentials_var _var_type;
00065       typedef SSLIOP::Credentials_out _out_type;
00066 
00067       /// Constructor
00068       SSLIOP_Credentials (::X509 * cert, ::EVP_PKEY * evp);
00069 
00070       /**
00071        * @name SecurityLevel3::Credentials Methods
00072        *
00073        * Methods required by the SecurityLevel3::Credentials
00074        * interface.
00075        */
00076       //@{
00077       virtual char * creds_id (void);
00078 
00079       virtual
00080       SecurityLevel3::CredentialsType creds_type (void)
00081         = 0;
00082 
00083       virtual SecurityLevel3::CredentialsUsage creds_usage ();
00084 
00085       virtual TimeBase::UtcT expiry_time (void);
00086 
00087       virtual SecurityLevel3::CredentialsState creds_state ();
00088 
00089       virtual char * add_relinquished_listener (
00090           SecurityLevel3::RelinquishedCredentialsListener_ptr listener);
00091 
00092       virtual void remove_relinquished_listener (const char * id);
00093       //@}
00094 
00095 
00096       //@{
00097       /// Return a pointer to the underlying X.509 certificate.
00098       /**
00099        * @note Caller owns the returned object.  Use a
00100        *       TAO::SSLIOP::X509_var.
00101        */
00102       ::X509 *x509 (void);
00103       //@}
00104 
00105       /// Return a pointer to the underlying private key.
00106       /**
00107        * @return Non-zero value if private key is used.
00108        *
00109        * @note Caller owns the returned object.  Use a
00110        *       TAO::SSLIOP::EVP_PKEY_var.
00111        */
00112       ::EVP_PKEY *evp (void);
00113       //@}
00114 
00115       bool operator== (const SSLIOP_Credentials &rhs);
00116 
00117       CORBA::ULong hash (void) const;
00118 
00119       // The static operations.
00120       static SSLIOP::Credentials_ptr _duplicate (SSLIOP::Credentials_ptr obj);
00121 
00122       static SSLIOP::Credentials_ptr _narrow (CORBA::Object_ptr obj);
00123 
00124       static SSLIOP::Credentials_ptr _nil (void)
00125       {
00126         return (SSLIOP::Credentials_ptr) 0;
00127       }
00128 
00129       //@}
00130 
00131     protected:
00132 
00133       /// Destructor.
00134       /**
00135        * Protected destructor to enforce proper memory management
00136        * through the reference counting  mechanism.
00137        */
00138       ~SSLIOP_Credentials (void);
00139 
00140     protected:
00141 
00142       /// Reference to the X.509 certificate associated with this SSLIOP
00143       /// Credentials object.
00144       SSLIOP::X509_var x509_;
00145 
00146       /// Reference to the private key associated with the X.509
00147       /// certificate.
00148       SSLIOP::EVP_PKEY_var evp_;
00149 
00150       /// Credentials Identifier.
00151       CORBA::String_var id_;
00152 
00153       /// The intended usage of the Credentials.
00154       SecurityLevel3::CredentialsUsage creds_usage_;
00155 
00156       /// The time these Credentials expire.
00157       TimeBase::UtcT expiry_time_;
00158 
00159       /// The validity of the Credentials.
00160       SecurityLevel3::CredentialsState creds_state_;
00161 
00162     };
00163 
00164 //   } // End SSLIOP namespace
00165 }   // End TAO namespace
00166 
00167 TAO_END_VERSIONED_NAMESPACE_DECL
00168 
00169 #if defined (__ACE_INLINE__)
00170 # include "orbsvcs/SSLIOP/SSLIOP_Credentials.inl"
00171 #endif /* __ACE_INLINE__ */
00172 
00173 #include /**/ "ace/post.h"
00174 
00175 #endif  /* TAO_SSLIOP_CREDENTIALS_H */

Generated on Sun Jan 27 16:12:24 2008 for TAO_SSLIOP by doxygen 1.3.6