OSDN Git Service

Replaced mongrel with thin
[redminele/redminele.git] / ruby / lib / ruby / gems / 1.8 / gems / eventmachine-0.12.10-x86-mswin32-60 / ext / ssl.h
1 /*****************************************************************************
2
3 $Id$
4
5 File:     ssl.h
6 Date:     30Apr06
7
8 Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
9 Gmail: blackhedd
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of either: 1) the GNU General Public License
13 as published by the Free Software Foundation; either version 2 of the
14 License, or (at your option) any later version; or 2) Ruby's License.
15
16 See the file COPYING for complete licensing information.
17
18 *****************************************************************************/
19
20
21 #ifndef __SslBox__H_
22 #define __SslBox__H_
23
24
25
26
27 #ifdef WITH_SSL
28
29 /******************
30 class SslContext_t
31 ******************/
32
33 class SslContext_t
34 {
35         public:
36                 SslContext_t (bool is_server, const string &privkeyfile, const string &certchainfile);
37                 virtual ~SslContext_t();
38
39         private:
40                 static bool bLibraryInitialized;
41
42         private:
43                 bool bIsServer;
44                 SSL_CTX *pCtx;
45
46                 EVP_PKEY *PrivateKey;
47                 X509 *Certificate;
48
49         friend class SslBox_t;
50 };
51
52
53 /**************
54 class SslBox_t
55 **************/
56
57 class SslBox_t
58 {
59         public:
60                 SslBox_t (bool is_server, const string &privkeyfile, const string &certchainfile, bool verify_peer, const unsigned long binding);
61                 virtual ~SslBox_t();
62
63                 int PutPlaintext (const char*, int);
64                 int GetPlaintext (char*, int);
65
66                 bool PutCiphertext (const char*, int);
67                 bool CanGetCiphertext();
68                 int GetCiphertext (char*, int);
69                 bool IsHandshakeCompleted() {return bHandshakeCompleted;}
70
71                 X509 *GetPeerCert();
72
73                 void Shutdown();
74
75         protected:
76                 SslContext_t *Context;
77
78                 bool bIsServer;
79                 bool bHandshakeCompleted;
80                 bool bVerifyPeer;
81                 SSL *pSSL;
82                 BIO *pbioRead;
83                 BIO *pbioWrite;
84
85                 PageList OutboundQ;
86 };
87
88 extern "C" int ssl_verify_wrapper(int, X509_STORE_CTX*);
89
90 #endif // WITH_SSL
91
92
93 #endif // __SslBox__H_
94