1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
115
  
116
  
117
  
118
  
119
  
120
  
121
  
122
  
123
  
124
  
125
  
126
  
127
  
128
  
129
  
130
  
131
  
132
  
133
  
134
  
135
  
136
  
137
  
138
  
139
  
140
  
141
  
142
  
143
  
144
  
145
  
146
  
147
  
148
  
149
  
150
  
151
  
152
  
153
  
154
  
155
  
156
  
157
  
158
  
159
  
160
  
161
  
162
  
163
  
164
  
165
  
166
  
167
  
168
  
169
  
170
  
171
  
172
  
173
  
174
  
175
  
176
  
177
  
178
  
179
  
180
  
181
  
182
  
183
  
184
  
185
  
186
  
187
  
188
  
189
  
190
  
191
  
192
  
193
  
194
  
#pike 8.1 
 
#ifdef SSL3_DEBUG 
#define SSL3_DEBUG_MSG(X ...)  werror(X) 
#else /*! SSL3_DEBUG */ 
#define SSL3_DEBUG_MSG(X ...) 
#endif /* SSL3_DEBUG */ 
 
inherit SSL.Context; 
 
// 
// --- Compat code below 
// 
 
protected Crypto.RSA.State compat_rsa; 
protected array(string(8bit)) compat_certificates; 
 
//! The servers default private RSA key. 
//! 
//! Compatibility, don't use. 
//! 
//! @deprecated find_cert 
//! 
//! @seealso 
//!   @[`certificates], @[find_cert()] 
Crypto.RSA.State `rsa() 
{ 
  return compat_rsa; 
} 
 
//! Set the servers default private RSA key. 
//! 
//! Compatibility, don't use. 
//! 
//! @deprecated add_cert 
//! 
//! @seealso 
//!   @[`certificates=], @[add_cert()] 
void `rsa=(Crypto.RSA.State k) 
{ 
  compat_rsa = k; 
  if (k && compat_certificates) { 
    catch { 
      add_cert(k, compat_certificates); 
    }; 
  } 
} 
 
//! The server's certificate, or a chain of X509.v3 certificates, with 
//! the server's certificate first and root certificate last. 
//! 
//! Compatibility, don't use. 
//! 
//! @deprecated find_cert 
//! 
//! @seealso 
//!   @[`rsa], @[find_cert()] 
array(string(8bit)) `certificates() 
{ 
  return compat_certificates; 
} 
 
//! Set the servers certificate, or a chain of X509.v3 certificates, with 
//! the servers certificate first and root certificate last. 
//! 
//! Compatibility, don't use. 
//! 
//! @deprecated add_cert 
//! 
//! @seealso 
//!   @[`rsa=], @[add_cert()] 
void `certificates=(array(string(8bit)) certs) 
{ 
  compat_certificates = certs; 
 
  if (compat_rsa && certs) { 
    catch { 
      add_cert(compat_rsa, certs); 
    }; 
  } 
} 
 
//! The clients RSA private key. 
//! 
//! Compatibility, don't use. 
//! 
//! @deprecated find_cert 
//! 
//! @seealso 
//!   @[`certificates], @[find_cert()] 
Crypto.RSA.State `client_rsa() 
{ 
  return compat_rsa; 
} 
 
//! Set the clients default private RSA key. 
//! 
//! Compatibility, don't use. 
//! 
//! @deprecated add_cert 
//! 
//! @seealso 
//!   @[`client_certificates=], @[add_cert()] 
void `client_rsa=(Crypto.RSA.State k) 
{ 
  compat_rsa = k; 
  if (k && compat_certificates) { 
    catch { 
      add_cert(k, compat_certificates); 
    }; 
  } 
} 
 
//! The client's certificate, or a chain of X509.v3 certificates, with 
//! the client's certificate first and root certificate last. 
//! 
//! Compatibility, don't use. 
//! 
//! @deprecated find_cert 
//! 
//! @seealso 
//!   @[`rsa], @[find_cert()] 
array(array(string(8bit))) `client_certificates() 
{ 
  return compat_certificates && ({ compat_certificates }); 
} 
 
//! Set the client's certificate, or a chain of X509.v3 certificates, with 
//! the client's certificate first and root certificate last. 
//! 
//! Compatibility, don't use. 
//! 
//! @deprecated add_cert 
//! 
//! @seealso 
//!   @[`rsa=], @[add_cert()] 
void `client_certificates=(array(array(string(8bit))) certs) 
{ 
  compat_certificates = certs && (sizeof(certs)?certs[0]:({})); 
 
  if (compat_rsa && certs) { 
    foreach(certs, array(string(8bit)) chain) { 
      catch { 
        add_cert(compat_rsa, chain); 
      }; 
    } 
  } 
} 
 
//! Compatibility. 
//! @deprecated find_cert 
Crypto.DSA.State `dsa() 
{ 
  return UNDEFINED; 
} 
 
//! Compatibility. 
//! @deprecated add_cert 
void `dsa=(Crypto.DSA.State k) 
{ 
  error("The old DSA API is not supported anymore.\n"); 
} 
 
//! Set @[preferred_suites] to RSA based methods. 
//! 
//! @param min_keylength 
//!   Minimum acceptable key length in bits. 
//! 
//! @seealso 
//!   @[dhe_dss_mode()], @[filter_weak_suites()] 
//! 
//! @deprecated get_suites 
void rsa_mode(int(0..)|void min_keylength) 
{ 
  SSL3_DEBUG_MSG("SSL.Context: rsa_mode()\n"); 
  preferred_suites = get_suites(min_keylength, 1); 
} 
 
//! Set @[preferred_suites] to DSS based methods. 
//! 
//! @param min_keylength 
//!   Minimum acceptable key length in bits. 
//! 
//! @seealso 
//!   @[rsa_mode()], @[filter_weak_suites()] 
//! 
//! @deprecated get_suites 
void dhe_dss_mode(int(0..)|void min_keylength) 
{ 
  SSL3_DEBUG_MSG("SSL.Context: dhe_dss_mode()\n"); 
  preferred_suites = get_suites(min_keylength, 1); 
}