include/df/dfssl.hpp

00001 //Public  Key = X509 Public Certificate (*.pem)
00002 //Private Key = RSA Private Key (*.pem)
00003 
00004 #define SSLVERSION_SSL_2  0x1
00005 #define SSLVERSION_SSL_23 0x2 //default
00006 #define SSLVERSION_SSL_3  0x3
00007 #define SSLVERSION_TLS_1  0x4
00008 
00009 class OpenSSL : public EncryptionClass {
00010     friend class OpenSSLSession;
00011   _PROTECTED_:
00012     PTR Data;
00013     ExclusiveUsage *Locks;
00014     int version;  //SSLVERSION_...
00015   public:
00016     void cbLock(int mode, int type);
00017     OpenSSL();
00018     ~OpenSSL();
00019     //user functions
00020     BOOL SetVersion(int newver);  //must call before Init()
00021     BOOL Init();
00022     BOOL Uninit();
00023     EncryptionSession *AllocSession();
00024     void FreeSession(EncryptionSession *);
00025     BOOL LoadPrivateKey(char *);
00026     BOOL LoadPublicKey(char *);
00027     BOOL LoadCA(char *);  //DF/1.0.7
00028     BOOL VerifyKeys();  //DF/1.0.7
00029     BOOL IsSecure();
00030 };
00031 
00032 class OpenSSLSession : public EncryptionSession {
00033     friend class OpenSSL;
00034   _PROTECTED_:
00035     PTR tmpbuf;
00036     OpenSSL *sys;
00037     BOOL connected;
00038     PTR Data;
00039   public:
00040     OpenSSLSession();
00041     ~OpenSSLSession();
00042     char *GetErrorMsg();
00043     BOOL Init();
00044     BOOL Uninit();
00045     BOOL Accept();
00046     BOOL Connect();
00047     BOOL InitAccept();
00048     BOOL InitConnect();
00049     int32 Read(PTR data, int32 len);   //reads decrypted data from SSL
00050     int32 Write(PTR data, int32 len);  //writes decrypted data to SSL
00051     int32 eRead(PTR data, int32 len);  //reads encrypted data from BIO
00052     int32 eWrite(PTR data, int32 len); //writes encrypted data to BIO
00053     BOOL Close();
00054     BOOL eReadPending();
00055     BOOL eWritePending();
00056     long cbRead(long);
00057     long cbWrite(long);
00058 };

Generated on Mon Mar 5 09:49:13 2007 for DigiForce by  doxygen 1.4.7