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

SSLSocket.h

00001 /*
00002    Copyright (C) 2002 the Strongroom project
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    @author Denis de Leeuw Duarte
00010 */
00011 
00012 #ifndef __SSLSOCKET_H_
00013 #define __SSLSOCKET_H_
00014 
00015 #include <Socket.h>
00016 #include <openssl/ssl.h>
00017 
00018 using namespace std;
00019 
00023 class SSLSocket : public Socket
00024 {
00025  public:       
00026 
00035     SSLSocket( const int socket, SSL_CTX &sslContext );
00036 
00044     SSLSocket( const char *hostname, uint16_t port, SSL_CTX &sslContext ); 
00045 
00046     ~SSLSocket();
00047   
00053     int readLine( string &msg );
00054   
00058     void interrupt();
00059   
00063     bool connected();
00064 
00065 protected:
00066 
00073     virtual int readBlock( void *buffer, int maxlen );
00074 
00081     virtual int writeBlock( const void *buffer, int length );
00082 
00083 
00084 private:
00085     int socketFD;
00086     BIO *stderrBio;
00087     BIO *socketBio;
00088     SSL *ssl;
00089     SSL_CTX *_sslContext;
00090     bool _connected;
00091     
00096     void sslError( const char *msg );
00097 };
00098 
00112 SSL_CTX* createClientSSLContext( const char *keyfile, const char *password, bool enableClientAuthentication );
00113 
00117 int _sslPassCb( char *passwordBuffer, int size, int rwflag, void *userdata );
00118 
00119 
00120 
00121 #endif /*__SSLSOCKET_H_*/

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