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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
// **********************************************************************
//
// Copyright (c) 2002
// ZeroC, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************
#ifndef ICE_SSL_PLUGIN_ICE
#define ICE_SSL_PLUGIN_ICE
#include <Ice/BuiltinSequences.ice>
#include <Ice/Plugin.ice>
#include <IceSSL/CertificateVerifierF.ice>
module IceSSL
{
/**
*
* A [Plugin] may serve as a Client, Server or both (ClientServer). A
* <literal>Context</literal> is set up inside the [Plugin] in order to handle
* either Client or Server roles. The <literal>Context</literal> represents a
* role-specific configuration.
*
* When making calls against the [Plugin] that require us to identify which
* <literal>Context</literal> to address, we use a <literal>ContextType</literal>
* as a parameter in the call.
*
**/
enum ContextType
{
/** Select only the Client <literal>Context</literal>, no modifications to the Server. */
Client,
/** Select only the Server <literal>Context</literal>, no modifications to the Client. */
Server,
/** Select and affect changes on both the Client and Server <literal>Context</literal>s. */
ClientServer
};
/**
*
* This is the main interface to a Communicator-specific instance of
* the SSL subsystem, which supports programmatic configuration of the
* SSL subsystem.
*
**/
local interface Plugin extends Ice::Plugin
{
/**
*
* Tell the Plugin to configure itself. If the Plugin is left in a
* non-configured state, it will load its configuration from
* the properties <literal>IceSSL.Server.Config</literal> or
* <literal>IceSSL.Client.Config</literal>, depending on the context
* type.
*
* Configuration property settings will also be loaded as part of
* this call, with the property values overriding those of the
* configuration file.
*
* @param contextType The <literal>Context</literal>(s) to configure.
*
**/
void configure(ContextType cType);
/**
*
* Tell the Plugin to configure the indicated <literal>Context</literal>
* using the settings in the indicated configuration file.
*
* If the Plugin is left in a non-configured state, it
* will load its configuration from the property
* <literal>IceSSL.Server.Config</literal> or
* <literal>IceSSL.Client.Config</literal>, depending on
* the context type.
*
* Configuration property settings will also be loaded as part of
* this call, with the property values overriding those of the
* configuration file.
*
* @param contextType The <literal>Context</literal>(s) which to configure.
*
* @param configFile The file which contains the SSL configuration
* information.
*
* @param certPath The path where certificates referenced in
* [configFile] may be found.
*
**/
void loadConfig(ContextType cType, string configFile, string certPath);
/**
*
* Set the [CertificateVerifier] used for the indicated [ContextType]
* role. All Plugin <literal>Context</literal>s are created with default
* [CertificateVerifier] objects configured. Replacement
* [CertificateVerifier]s can be specified with this method.
*
* This method only affects new connections -- existing
* connections are left unchanged.
*
* @param contextType The <literal>Context</literal>(s) in which to install the
* Certificate Verifier.
*
* @param certVerifier The [CertificateVerifier] to install.
*
* @see IceSSL::CertificateVerifier
*
**/
void setCertificateVerifier(ContextType cType, CertificateVerifier certVerifier);
/**
*
* Add a trusted certificate to the Plugin's default certificate
* store. The provided certificate (passed in Base64 encoded
* binary DER format, as per the PEM format) will be added to the
* trust list, so that it, and all certificates signed by the
* corresponding private key, will be trusted.
*
* This method only affects new connections -- existing
* connections are left unchanged.
*
* @param contextType The <literal>Context</literal>(s) in which to add
* the trusted certificate.
*
* @param certificate The certificate, in Base64 encoded binary
* DER format, to be trusted.
*
**/
void addTrustedCertificateBase64(ContextType cType, string certificate);
/**
*
* Add a trusted certificate to the Plugin's default certificate
* store. The provided certificate (passed in binary DER format)
* will be added to the trust list, so that it, and all certificates
* signed by the corresponding private key, will be trusted.
*
* This method only affects new connections -- existing
* connections are left unchanged.
*
* @param contextType The <literal>Context</literal>(s) in which to add
* the trusted certificate.
*
* @param certificate The certificate, in binary DER format, to be trusted.
*
**/
void addTrustedCertificate(ContextType cType, Ice::ByteSeq certificate);
/**
*
* Set the RSA keys to be used by the Plugin when operating in
* the context mode specified by [contextType].
*
* This method only affects new connections -- existing
* connections are left unchanged.
*
* @param contextType The <literal>Context</literal>(s) in which to
* set/replace the RSA keys.
*
* @param privateKey The RSA private key, in Base64 encoded binary
* DER format.
*
* @param publicKey The RSA public key, in Base64 encoded binary
* DER format.
*
**/
void setRSAKeysBase64(ContextType cType, string privateKey, string publicKey);
/**
*
* Set the RSA keys to be used by the Plugin when operating in
* the context mode specified by [contextType].
*
* This method only affects new connections -- existing
* connections are left unchanged.
*
* @param contextType The <literal>Context</literal>(s) in which to
* set/replace the RSA keys.
*
* @param privateKey The RSA private key, in binary DER format.
*
* @param publicKey The RSA public key, in binary DER format.
*
**/
void setRSAKeys(ContextType cType, Ice::ByteSeq privateKey, Ice::ByteSeq publicKey);
/**
*
* Retrieves an instance of the stock [CertificateVerifier] that is
* installed by default in all Plugin instances.
*
* @return CertificateVerifier
*
**/
CertificateVerifier getDefaultCertVerifier();
/**
*
* Returns an instance of a [CertificateVerifier] that only accepts
* a single certificate, that being the RSA certificate represented by
* the binary DER encoding contained in the provided byte sequence. This
* is useful if you wish your application to accept connections from one
* party.
*
* <note><para>Be sure to use the <literal>peer</literal>
* <literal>verifymode</literal> in your SSL configuration file.</para>
* </note>
*
* @param certificate A DER encoded RSA certificate.
*
* @return CertificateVerifier
*
**/
CertificateVerifier getSingleCertVerifier(Ice::ByteSeq certificate);
};
};
#endif
|