Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

SSLServerSocket.h

00001 #ifndef __SSLSERVERSOCKET_H_
00002 #define __SSLSERVERSOCKET_H_
00003 
00010 #include <ServerSocket.h>
00011 #include <SSLSocket.h>
00012 #include <string>
00013 
00014 #define PASSWORD_SIZE_LIMIT 265
00015 
00016 class SSLServerSocket: public ServerSocket
00017 {
00018 
00019   friend int passwordCallbackForward(char *passwordBuffer, int size, int rwflag, void *userdata);
00020 
00021  public:
00022   
00031   SSLServerSocket( const unsigned int port, const unsigned int maxNumConnect, const char *sslKeyFile, const char *sslPassword, const char *caList ); 
00032   SSLServerSocket( const unsigned int port, const unsigned int maxNumConnect, const string sslKeyFile, const string sslPassword, const string caList ); 
00033 
00034   ~SSLServerSocket();
00035 
00040   SSLSocket *accept();
00041 
00046   bool ready();
00047 
00048  private:
00049 
00050   int socketFD;
00051   char keyfilePassword[PASSWORD_SIZE_LIMIT + 1];
00052   SSL_CTX *sslContext;
00053   BIO *socketBio;
00054   BIO *stderrBio;
00055   bool _ready;
00056 
00057   /*
00058    * Support functions for SSL library initialization.
00059    */
00060   void initSSL();
00061 
00062   /*
00063    * Prints SSL error string and kills the application. 
00064    * @param mesg an extra error message that will be printed.
00065    */
00066   void ssl_fatal_error( const char *mesg );
00067 
00068   /*
00069    * Callback method used by openSSL to get the certificatefile password.
00070    */
00071   int passwordCallback( char *passwordBuffer, int size, int rwflag );
00072 
00073   /*
00074    * Shared constructor code. C++ does not support 'this()' calls. 
00075    */
00076   void internalInit( const unsigned int port, const unsigned int maxNumConnect, const char *sslKeyFile, const char *sslPassword, const char *caList );
00077 };
00078 
00079 
00083 int passwordCallbackForward(char *passwordBuffer, int size, int rwflag, void *userdata);
00084 
00085 #endif /*__SSLSERVERSOCKET_H_*/

Generated on Wed Feb 18 13:45:55 2004 for strongroom by doxygen1.2.18