SSLIOP_EVP_PKEY.cpp File Reference

#include "orbsvcs/SSLIOP/SSLIOP_EVP_PKEY.h"
#include <openssl/x509.h>
#include <openssl/rsa.h>
#include <openssl/dsa.h>
#include <openssl/dh.h>
#include "orbsvcs/SSLIOP/params_dup.h"

Include dependency graph for SSLIOP_EVP_PKEY.cpp:

Include dependency graph

Go to the source code of this file.

Functions

 ACE_RCSID (SSLIOP, SSLIOP_EVP_PKEY,"SSLIOP_EVP_PKEY.cpp, v 1.10 2006/03/14 06:14:35 jtc Exp") TAO_BEGIN_VERSIONED_NAMESPACE_DECL


Function Documentation

ACE_RCSID SSLIOP  ,
SSLIOP_EVP_PKEY  ,
"SSLIOP_EVP_PKEY.  cpp,
v 1.10 2006/03/14 06:14:35 jtc Exp" 
 

Definition at line 12 of file SSLIOP_EVP_PKEY.cpp.

References TAO::SSLIOP::OpenSSL_st_var< T >::_retn(), DHPARAMS_DUP_WRAPPER_NAME, DSAPARAMS_DUP_WRAPPER_NAME, EVP_PKEY, TAO::SSLIOP::EVP_PKEY_var, and TAO::SSLIOP::OpenSSL_st_var< T >::in().

00014                                                     :14:35 jtc Exp")
00015 
00016 
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018 
00019 ::EVP_PKEY *
00020 TAO::SSLIOP::OpenSSL_traits< ::EVP_PKEY >::copy (::EVP_PKEY const & key)
00021 {
00022   ::EVP_PKEY * pkey = const_cast< ::EVP_PKEY *> (&key);
00023 
00024   // We're using the EVP_PKEY_var even though it depends on this
00025   // trait function.  This works since we're not actually using
00026   // any of the EVP_PKEY_var methods that call this copy()
00027   // trait.  This allows us to maintain exception safety.
00028   TAO::SSLIOP::EVP_PKEY_var p = ::EVP_PKEY_new ();
00029 
00030   switch (::EVP_PKEY_type (pkey->type))
00031     {
00032     case EVP_PKEY_RSA:
00033       {
00034         RSA * rsa = ::EVP_PKEY_get1_RSA (pkey);
00035         if (rsa != 0)
00036           {
00037             // Not exception safe!
00038             ::EVP_PKEY_set1_RSA (p.in (), RSAPrivateKey_dup (rsa));
00039             ::RSA_free (rsa);
00040           }
00041       }
00042       break;
00043 
00044     case EVP_PKEY_DSA:
00045       {
00046         DSA * dsa = ::EVP_PKEY_get1_DSA (pkey);
00047         if (dsa != 0)
00048           {
00049             // Not exception safe!
00050             ::EVP_PKEY_set1_DSA (p.in (), DSAPARAMS_DUP_WRAPPER_NAME (dsa));
00051             ::DSA_free (dsa);
00052           }
00053       }
00054       break;
00055 
00056     case EVP_PKEY_DH:
00057       {
00058         DH * dh = ::EVP_PKEY_get1_DH (pkey);
00059         if (dh != 0)
00060           {
00061             // Not exception safe!
00062             ::EVP_PKEY_set1_DH (p.in (), DHPARAMS_DUP_WRAPPER_NAME (dh));
00063             ::DH_free (dh);
00064           }
00065       }
00066       break;
00067 
00068     default:
00069       // We should never get here!
00070       return 0;
00071     }
00072 
00073   return p._retn ();
00074 }


Generated on Thu Nov 9 13:54:53 2006 for TAO_SSLIOP by doxygen 1.3.6