include/TransportTLSCommon.H

Go to the documentation of this file.
00001 /* ${copyright}$ */
00002 /* $Id: TransportTLSCommon.H 768 2006-06-19 21:33:19Z koji $ */
00007 #ifndef __TRANSPORTTLSCOMMON_H__
00008 #define __TRANSPORTTLSCOMMON_H__
00009 
00010 #include <string>
00011 
00012 #include <openssl/bio.h>
00013 #include <openssl/ssl.h>
00014 
00015 #include "libepp_nicbr.H"
00016 
00017 #include "StrUtil.H"
00018 
00019 using std::string;
00020 
00021 LIBEPP_NICBR_NS_BEGIN
00022 
00024 class TransportTLSCommon
00025 {
00026 public:
00028   TransportTLSCommon();
00029 
00031   ~TransportTLSCommon();
00032 
00034 
00038   void read(string &xml_payload, const int &timeout = TIMEOUT);
00039 
00041 
00045   void write(const string &xml_payload, const int &timeout = TIMEOUT);
00046 
00048   void disconnect();
00049 
00051 
00054   string get_openssl_msg();
00055 
00057 
00061   long cert_common_name_check(const string &common_name);
00062 
00064   void enable_cert_common_name_check();
00065 
00067   void disable_cert_common_name_check();
00068 
00069 protected:
00071   void seed_prng();
00072 
00074 
00082   static int pem_passwd_cb(char *buf, int size, int rwflag, void *userdata);
00083 
00085 
00090   void setup_context(const string &cert_file,
00091                      const string &root_ca_file,
00092                      const string &pem_passphrase = "");
00093 
00095   void set_non_blocking();
00096 
00098   BIO *_conn;
00099 
00101   SSL_CTX *_ssl_ctx;
00102 
00104   SSL *_ssl;
00105 
00107   static string _pem_passphrase;
00108 
00110   static const int TIMEOUT;
00111 
00113   bool _cert_common_name_check_enabled;
00114 };
00115 
00116 LIBEPP_NICBR_NS_END
00117 #endif //__TRANSPORTTLSCOMMON_H__

Generated on Mon Jun 19 19:45:01 2006 for libepp_nicbr by  doxygen 1.4.6