williamr@2
|
1 |
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
|
williamr@2
|
17 |
#ifndef __SECURESOCKETINTERFACE_H__
|
williamr@2
|
18 |
#define __SECURESOCKETINTERFACE_H__
|
williamr@2
|
19 |
|
williamr@2
|
20 |
#include <e32base.h>
|
williamr@2
|
21 |
#include <sslerr.h>
|
williamr@2
|
22 |
#include <x509cert.h>
|
williamr@2
|
23 |
#include <es_sock.h>
|
williamr@2
|
24 |
|
williamr@2
|
25 |
// File description
|
williamr@2
|
26 |
/**
|
williamr@2
|
27 |
* @file SecureSocketInterface.h
|
williamr@2
|
28 |
* Definition of the MSecureSocket class.
|
williamr@2
|
29 |
*
|
williamr@2
|
30 |
* @publishedAll
|
williamr@2
|
31 |
* @released
|
williamr@2
|
32 |
*/
|
williamr@2
|
33 |
|
williamr@2
|
34 |
/**
|
williamr@2
|
35 |
* Server client certificate mode.
|
williamr@2
|
36 |
* Specifies if client certificates will be asked for when in server mode, and also if they are optional
|
williamr@2
|
37 |
* or must be provided to complete the handshake successfully.
|
williamr@2
|
38 |
*
|
williamr@2
|
39 |
* @since v7.0
|
williamr@2
|
40 |
*/
|
williamr@2
|
41 |
enum TClientCertMode
|
williamr@2
|
42 |
{
|
williamr@2
|
43 |
/** Client certificates won't be asked for during handshake negotiation. */
|
williamr@2
|
44 |
EClientCertModeIgnore,
|
williamr@2
|
45 |
/** Client certificates will be requested, but are not compulsory,
|
williamr@2
|
46 |
* and the handshake will continue if the client doesn't supply one. */
|
williamr@2
|
47 |
EClientCertModeOptional,
|
williamr@2
|
48 |
/** Client certificates must be supplied, and the handshake will fail if
|
williamr@2
|
49 |
* the client does not provide a one. */
|
williamr@2
|
50 |
EClientCertModeRequired
|
williamr@2
|
51 |
};
|
williamr@2
|
52 |
|
williamr@2
|
53 |
/**
|
williamr@2
|
54 |
* Untrusted certificate dialog mode.
|
williamr@2
|
55 |
* When an untrusted certificate is received, the dialog mode determines if the handshake
|
williamr@2
|
56 |
* fails automatically, or if a dialog is displayed allowing the user the option of continuing
|
williamr@2
|
57 |
* anyway.
|
williamr@2
|
58 |
*
|
williamr@2
|
59 |
* @since v7.0
|
williamr@2
|
60 |
*/
|
williamr@2
|
61 |
enum TDialogMode
|
williamr@2
|
62 |
{
|
williamr@2
|
63 |
/** All untrusted certificates result in a user dialog. */
|
williamr@2
|
64 |
EDialogModeAttended,
|
williamr@2
|
65 |
/** Untrusted certificates are canceled without user confirmation. */
|
williamr@2
|
66 |
EDialogModeUnattended
|
williamr@2
|
67 |
};
|
williamr@2
|
68 |
|
williamr@2
|
69 |
|
williamr@2
|
70 |
class MSecureSocket
|
williamr@2
|
71 |
/**
|
williamr@2
|
72 |
* Abstract interface API for secure socket implementations.
|
williamr@2
|
73 |
*
|
williamr@2
|
74 |
* MSecureSocket is the interface that secure socket implementations must adhere to.
|
williamr@2
|
75 |
* The API supports both client and server operation, see individual implementations'
|
williamr@2
|
76 |
* documentation for details of client/server operation that they may support.
|
williamr@2
|
77 |
*
|
williamr@2
|
78 |
* Secure socket implementations will be used to secure an already open and connected socket.
|
williamr@2
|
79 |
* The class must be passed a reference to an already open and connected socket when a new
|
williamr@2
|
80 |
* secure socket is created. New secure sockets are created through the CSecureSocket class,
|
williamr@2
|
81 |
* which hides the MSecureSocket class and the underlying plug-in nature of implementations
|
williamr@2
|
82 |
* from applications. Secure socket implementations MUST provide a NewL function that
|
williamr@2
|
83 |
* matches the following:
|
williamr@2
|
84 |
*
|
williamr@2
|
85 |
* @code
|
williamr@2
|
86 |
* static MSecureSocket* NewL( RSocket& aSocket, const TDesC& aProtocol );
|
williamr@2
|
87 |
* @endcode
|
williamr@2
|
88 |
*
|
williamr@2
|
89 |
* aSocket A reference to an already opened and connected socket.
|
williamr@2
|
90 |
*
|
williamr@2
|
91 |
* aProtocol A descriptor containing the name of a protocol, i.e. SSL3.0, TLS1.0, that the
|
williamr@2
|
92 |
* application must specify when it creates the secure socket. The maximum length that can
|
williamr@2
|
93 |
* be specified for a protocol name is 32 characters.
|
williamr@2
|
94 |
*
|
williamr@2
|
95 |
* For error code definitions see SSLErr.h
|
williamr@2
|
96 |
*
|
williamr@2
|
97 |
* @since 6.2
|
williamr@2
|
98 |
*/
|
williamr@2
|
99 |
{
|
williamr@2
|
100 |
|
williamr@2
|
101 |
public:
|
williamr@2
|
102 |
|
williamr@2
|
103 |
/**
|
williamr@2
|
104 |
* Gets the list of cipher suites that are available to use.
|
williamr@2
|
105 |
* The list of cipher suites that will be used by default will be returned in the descriptor.
|
williamr@2
|
106 |
* They are returned in the order that they will be used during a handshake, and are assumed to
|
williamr@2
|
107 |
* be in the format as per the SSL/TLS RFCs, i.e. [0x??][0x??] for each suite.
|
williamr@2
|
108 |
* See individual implementation notes for any differences.
|
williamr@2
|
109 |
*
|
williamr@2
|
110 |
* @param aCiphers A reference to a descriptor, should be at least 64 bytes long.
|
williamr@2
|
111 |
* @return Any one of the system error codes, or KErrNone on success. */
|
williamr@2
|
112 |
virtual TInt AvailableCipherSuites( TDes8& aCiphers ) = 0;
|
williamr@2
|
113 |
|
williamr@2
|
114 |
/**
|
williamr@2
|
115 |
* Cancels all outstanding operations.
|
williamr@2
|
116 |
* This method will cancel all outstanding operations with the exception of Shutdown,
|
williamr@2
|
117 |
* which cannot be canceled once started.
|
williamr@2
|
118 |
* See individual implementation notes for behaviour after canceling. */
|
williamr@2
|
119 |
virtual void CancelAll() = 0;
|
williamr@2
|
120 |
|
williamr@2
|
121 |
/**
|
williamr@2
|
122 |
* Cancels an outstanding handshake operation.
|
williamr@2
|
123 |
* This method is used to cancel the StartClientHandshake, StartServerHandshake and
|
williamr@2
|
124 |
* RenegociateHandshake operations.
|
williamr@2
|
125 |
* See individual implementation notes for behaviour after canceling.*/
|
williamr@2
|
126 |
virtual void CancelHandshake() = 0;
|
williamr@2
|
127 |
|
williamr@2
|
128 |
/**
|
williamr@2
|
129 |
* Cancels any outstanding read operation.
|
williamr@2
|
130 |
* See individual implementation notes for behaviour after canceling. */
|
williamr@2
|
131 |
virtual void CancelRecv() = 0;
|
williamr@2
|
132 |
|
williamr@2
|
133 |
/**
|
williamr@2
|
134 |
* Cancels any outstanding send operation.
|
williamr@2
|
135 |
* See individual implementation notes for behaviour after canceling. */
|
williamr@2
|
136 |
virtual void CancelSend() = 0;
|
williamr@2
|
137 |
|
williamr@2
|
138 |
/**
|
williamr@2
|
139 |
* Gets the current client certificate.
|
williamr@2
|
140 |
*
|
williamr@2
|
141 |
* When a secure socket is acting in server mode, the returned certificate will be the certificate that the remote
|
williamr@2
|
142 |
* client provided.
|
williamr@2
|
143 |
* When acting in client mode, the certificate returned will be the one that the client will send to the
|
williamr@2
|
144 |
* remote server if requested.
|
williamr@2
|
145 |
*
|
williamr@2
|
146 |
* Note that if there is no client certificate defined, either in server or client mode,
|
williamr@2
|
147 |
* this method will return NULL.
|
williamr@2
|
148 |
*
|
williamr@2
|
149 |
* @return A pointer to the client certificate, or NULL if none exists.*/
|
williamr@2
|
150 |
virtual const CX509Certificate* ClientCert() = 0;
|
williamr@2
|
151 |
|
williamr@2
|
152 |
/**
|
williamr@2
|
153 |
* Returns the current client certificate mode.
|
williamr@2
|
154 |
* The client certificate mode is used when the socket is acting as a server, and determines if a
|
williamr@2
|
155 |
* client certificate is requested.
|
williamr@2
|
156 |
* @see TClientCertMode for details of each mode.
|
williamr@2
|
157 |
* @return TClientCertMode The current mode that is set. */
|
williamr@2
|
158 |
virtual TClientCertMode ClientCertMode() = 0;
|
williamr@2
|
159 |
|
williamr@2
|
160 |
/**
|
williamr@2
|
161 |
* Closes the secure connection.
|
williamr@2
|
162 |
* Implementations should terminate the secure connection gracefully as appropriate to their protocol.
|
williamr@2
|
163 |
* It is assumed that they also close the socket when finished unless explicitly stated. They MUST NOT
|
williamr@2
|
164 |
* destroy the RSocket object, this is left to the client application.
|
williamr@2
|
165 |
*/
|
williamr@2
|
166 |
virtual void Close() = 0;
|
williamr@2
|
167 |
|
williamr@2
|
168 |
/**
|
williamr@2
|
169 |
* Gets the current cipher suite in use.
|
williamr@2
|
170 |
* The current cipher suite is returned in the referenced buffer.
|
williamr@2
|
171 |
*
|
williamr@2
|
172 |
* Note that it is assumed that implementations return cipher suites in two byte format
|
williamr@2
|
173 |
* as is the case with the TLS/SSL protocols, i.e. [0x??][0x??].
|
williamr@2
|
174 |
* Implementations should specify if they differ.
|
williamr@2
|
175 |
*
|
williamr@2
|
176 |
* @param aCipherSuite A reference to a descriptor at least 2 bytes long,
|
williamr@2
|
177 |
implementations that differ from the [0x??][0x??] format may
|
williamr@2
|
178 |
require larger descriptors. See individual implementations
|
williamr@2
|
179 |
notes for details.
|
williamr@2
|
180 |
* @return Any one of the system error codes, or KErrNone on success. */
|
williamr@2
|
181 |
virtual TInt CurrentCipherSuite( TDes8& aCipherSuite ) = 0;
|
williamr@2
|
182 |
|
williamr@2
|
183 |
/**
|
williamr@2
|
184 |
* Gets the current dialog mode.
|
williamr@2
|
185 |
* @see TDialogMode for description of valid modes.
|
williamr@2
|
186 |
* @return TDialogMode The current dialog mode. */
|
williamr@2
|
187 |
virtual TDialogMode DialogMode() = 0;
|
williamr@2
|
188 |
|
williamr@2
|
189 |
/**
|
williamr@2
|
190 |
* Flushes the session cache.
|
williamr@2
|
191 |
*
|
williamr@2
|
192 |
* If protocols implement a session cache, this method will cause that cache to be flushed. */
|
williamr@2
|
193 |
virtual void FlushSessionCache() = 0;
|
williamr@2
|
194 |
|
williamr@2
|
195 |
/**
|
williamr@2
|
196 |
* Gets an option.
|
williamr@2
|
197 |
*
|
williamr@2
|
198 |
* SecureSocket implementations may provide options that can be read with this method.
|
williamr@2
|
199 |
* See individual implementation notes for details.
|
williamr@2
|
200 |
*
|
williamr@2
|
201 |
* @param aOptionName An integer constant which identifies an option.
|
williamr@2
|
202 |
* @param aOptionLevel An integer constant which identifies level of an option.
|
williamr@2
|
203 |
* @param aOption Option value packaged in a descriptor.
|
williamr@2
|
204 |
* @return KErrNone if successful, otherwise another of the system-wide error codes. */
|
williamr@2
|
205 |
virtual TInt GetOpt(TUint aOptionName,TUint aOptionLevel,TDes8& aOption) = 0;
|
williamr@2
|
206 |
|
williamr@2
|
207 |
/**
|
williamr@2
|
208 |
* Gets an option.
|
williamr@2
|
209 |
*
|
williamr@2
|
210 |
* Secure socket implementations may provide options that can be read with this method.
|
williamr@2
|
211 |
* See individual implementation notes for details.
|
williamr@2
|
212 |
*
|
williamr@2
|
213 |
* @param aOptionName An integer constant which identifies an option.
|
williamr@2
|
214 |
* @param aOptionLevel An integer constant which identifies level of an option.
|
williamr@2
|
215 |
* @param aOption Option value as an integer.
|
williamr@2
|
216 |
* @return KErrNone if successful, otherwise another of the system-wide error codes. */
|
williamr@2
|
217 |
virtual TInt GetOpt(TUint aOptionName,TUint aOptionLevel,TInt& aOption) = 0;
|
williamr@2
|
218 |
|
williamr@2
|
219 |
/**
|
williamr@2
|
220 |
* Get the protocol in use.
|
williamr@2
|
221 |
*
|
williamr@2
|
222 |
* This method can be used to return the particular protocol/version that is being
|
williamr@2
|
223 |
* used by implementations that support different protocols/versions.
|
williamr@2
|
224 |
* See individual implementation notes for details.
|
williamr@2
|
225 |
*
|
williamr@2
|
226 |
* @param aProtocol A descriptor containing the protocol name/version that is being
|
williamr@2
|
227 |
used. Protocol names can be upto 32 characters long, and so a
|
williamr@2
|
228 |
descriptor of at least that size is required.
|
williamr@2
|
229 |
* @return KErrNone if successful; otherwise, another of the system-wide error codes. */
|
williamr@2
|
230 |
virtual TInt Protocol(TDes& aProtocol) = 0;
|
williamr@2
|
231 |
|
williamr@2
|
232 |
/**
|
williamr@2
|
233 |
* Receives data from the socket.
|
williamr@2
|
234 |
*
|
williamr@2
|
235 |
* This is an asynchronous method, and will complete when the descriptor has been filled.
|
williamr@2
|
236 |
* Only one Recv or RecvOneOrMore operation can be outstanding at any time.
|
williamr@2
|
237 |
*
|
williamr@2
|
238 |
* @param aDesc A descriptor where data read will be placed.
|
williamr@2
|
239 |
* @param aStatus On completion, will contain an error code: see the system-wide error
|
williamr@2
|
240 |
codes. Note that KErrEof indicates that a remote connection is
|
williamr@2
|
241 |
closed, and that no more data is available for reading. */
|
williamr@2
|
242 |
virtual void Recv(TDes8& aDesc, TRequestStatus & aStatus) = 0;
|
williamr@2
|
243 |
|
williamr@2
|
244 |
/**
|
williamr@2
|
245 |
* Receives data from the socket.
|
williamr@2
|
246 |
*
|
williamr@2
|
247 |
* This is an asynchronous call, and will complete when at least one byte has been read.
|
williamr@2
|
248 |
* Only one Recv or RecvOneOrMore operation can be outstanding at any time.
|
williamr@2
|
249 |
*
|
williamr@2
|
250 |
* @param aDesc A descriptor where data read will be placed.
|
williamr@2
|
251 |
* @param aStatus On completion, will contain an error code: see the system-wide error
|
williamr@2
|
252 |
* codes. Note that KErrEof indicates that a remote connection is closed,
|
williamr@2
|
253 |
* and that no more data is available for reading.
|
williamr@2
|
254 |
* @param aLen On return, a length which indicates how much data was read.
|
williamr@2
|
255 |
* This is the same as the length of the returned aDesc. */
|
williamr@2
|
256 |
virtual void RecvOneOrMore(TDes8& aDesc, TRequestStatus& aStatus, TSockXfrLength& aLen) = 0;
|
williamr@2
|
257 |
|
williamr@2
|
258 |
/**
|
williamr@2
|
259 |
* Initiates a renegotiation of the secure connection.
|
williamr@2
|
260 |
*
|
williamr@2
|
261 |
* This is an asynchronous method that completes when renegotiation is complete.
|
williamr@2
|
262 |
* It is valid for both client and server operation.
|
williamr@2
|
263 |
* There can only be one outstanding RenegotiateHandshake operation at a time.
|
williamr@2
|
264 |
*
|
williamr@2
|
265 |
* @param aStatus On completion, will contain an error code: see the system-wide error
|
williamr@2
|
266 |
codes. */
|
williamr@2
|
267 |
virtual void RenegotiateHandshake(TRequestStatus& aStatus) = 0;
|
williamr@2
|
268 |
|
williamr@2
|
269 |
/**
|
williamr@2
|
270 |
* Send data over the socket.
|
williamr@2
|
271 |
*
|
williamr@2
|
272 |
* This is an asynchronous call. Only one Send operation can be outstanding at any time.
|
williamr@2
|
273 |
* @param aDesc A constant descriptor containing the data to be sent.
|
williamr@2
|
274 |
* @param aStatus On completion, will contain an error code: see the system-wide error
|
williamr@2
|
275 |
codes. */
|
williamr@2
|
276 |
virtual void Send(const TDesC8& aDesc, TRequestStatus& aStatus) = 0;
|
williamr@2
|
277 |
|
williamr@2
|
278 |
/**
|
williamr@2
|
279 |
* Send data over the socket.
|
williamr@2
|
280 |
*
|
williamr@2
|
281 |
* This is an asynchronous call. Only one Send operation can be outstanding at any time.
|
williamr@2
|
282 |
*
|
williamr@2
|
283 |
* @param aDesc A constant descriptor.
|
williamr@2
|
284 |
* @param aStatus On completion, will contain an error code: see the system-wide error
|
williamr@2
|
285 |
* codes.
|
williamr@2
|
286 |
* @param aLen Filled in with amount of data sent before completion */
|
williamr@2
|
287 |
virtual void Send(const TDesC8& aDesc, TRequestStatus& aStatus, TSockXfrLength& aLen) = 0;
|
williamr@2
|
288 |
|
williamr@2
|
289 |
/**
|
williamr@2
|
290 |
* Gets the current server certificate.
|
williamr@2
|
291 |
*
|
williamr@2
|
292 |
* When a secure socket is acting in client mode, the returned certificate will be the
|
williamr@2
|
293 |
* certificate for the remote server.
|
williamr@2
|
294 |
* When acting in server mode, the certificate returned will be the one that is being
|
williamr@2
|
295 |
* used as the server certificate.
|
williamr@2
|
296 |
*
|
williamr@2
|
297 |
* @return CX509Certificate A pointer to the certificate. */
|
williamr@2
|
298 |
virtual const CX509Certificate* ServerCert() = 0;
|
williamr@2
|
299 |
|
williamr@2
|
300 |
/**
|
williamr@2
|
301 |
* Sets a list of cipher suites that are available to use.
|
williamr@2
|
302 |
*
|
williamr@2
|
303 |
* It is assumed that implementations require a list of cipher suites supplied in a descriptor in two
|
williamr@2
|
304 |
* byte format as is the case with the TLS/SSL protocols, i.e. [0x??][0x??].
|
williamr@2
|
305 |
* It is also assumed that the order of suites is important, and so they should be listed
|
williamr@2
|
306 |
* with the preferred suites first.
|
williamr@2
|
307 |
* Implementations should specify if they differ.
|
williamr@2
|
308 |
*
|
williamr@2
|
309 |
* @param aCiphers A descriptor containing the list or ciphers suites to use.
|
williamr@2
|
310 |
* @return Any one of the system error codes, or KErrNone on success. */
|
williamr@2
|
311 |
virtual TInt SetAvailableCipherSuites(const TDesC8& aCiphers) = 0;
|
williamr@2
|
312 |
|
williamr@2
|
313 |
/**
|
williamr@2
|
314 |
* Sets the client certificate to use.
|
williamr@2
|
315 |
*
|
williamr@2
|
316 |
* When a secure socket is acting in client mode, this method will set the certificate
|
williamr@2
|
317 |
* that will be used if a server requests one.
|
williamr@2
|
318 |
* When acting in server mode, this method will perform no action, but will return KErrNotSupported.
|
williamr@2
|
319 |
* @param aCert A reference to the certificate to use.
|
williamr@2
|
320 |
* @return Any one of the system error codes, or KErrNone on success. */
|
williamr@2
|
321 |
virtual TInt SetClientCert(const CX509Certificate& aCert) = 0;
|
williamr@2
|
322 |
|
williamr@2
|
323 |
/**
|
williamr@2
|
324 |
* Set the client certificate mode.
|
williamr@2
|
325 |
*
|
williamr@2
|
326 |
* When a secure socket is acting in server mode, the client certificate mode determines
|
williamr@2
|
327 |
* if clients will be requested to provide a certificate.
|
williamr@2
|
328 |
* When acting in client mode, this method will perform no action, but will return KErrNotSupported.
|
williamr@2
|
329 |
*
|
williamr@2
|
330 |
* @see TClientCertMode for details of each available mode.
|
williamr@2
|
331 |
* @param aClientCertMode The client certificate mode to use.
|
williamr@2
|
332 |
* @return Any one of the system error codes, or KErrNone on success. */
|
williamr@2
|
333 |
virtual TInt SetClientCertMode(const TClientCertMode aClientCertMode) = 0;
|
williamr@2
|
334 |
|
williamr@2
|
335 |
/**
|
williamr@2
|
336 |
* Set the untrusted certificate dialog mode.
|
williamr@2
|
337 |
*
|
williamr@2
|
338 |
* Determines if a dialog is displayed when an untrusted certificate is received.
|
williamr@2
|
339 |
*
|
williamr@2
|
340 |
* @see TDialogMode for details of each available mode.
|
williamr@2
|
341 |
* @param aDialogMode The dialog mode to use.
|
williamr@2
|
342 |
* @return Any one of the system error codes, or KErrNone on success. */
|
williamr@2
|
343 |
virtual TInt SetDialogMode(const TDialogMode aDialogMode) = 0;
|
williamr@2
|
344 |
|
williamr@2
|
345 |
/**
|
williamr@2
|
346 |
* Sets a socket option.
|
williamr@2
|
347 |
*
|
williamr@2
|
348 |
* Secure socket implementations may provide options that can be set with this method.
|
williamr@2
|
349 |
* See individual implementation notes for details.
|
williamr@2
|
350 |
*
|
williamr@2
|
351 |
* @param aOptionName An integer constant which identifies an option.
|
williamr@2
|
352 |
* @param aOptionLevel An integer constant which identifies level of an option:
|
williamr@2
|
353 |
* i.e. an option level groups related options together.
|
williamr@2
|
354 |
* @param aOption Option value packaged in a descriptor
|
williamr@2
|
355 |
* @return Any one of the system error codes, or KErrNone on success. */
|
williamr@2
|
356 |
virtual TInt SetOpt(TUint aOptionName,TUint aOptionLevel, const TDesC8& aOption=KNullDesC8()) = 0;
|
williamr@2
|
357 |
|
williamr@2
|
358 |
/**
|
williamr@2
|
359 |
* Sets an option.
|
williamr@2
|
360 |
*
|
williamr@2
|
361 |
* SecureSocket implementations may provide options that can be set with this method.
|
williamr@2
|
362 |
* See individual implementation notes for details.
|
williamr@2
|
363 |
*
|
williamr@2
|
364 |
* @param aOptionName An integer constant which identifies an option.
|
williamr@2
|
365 |
* @param aOptionLevel An integer constant which identifies level of an option:
|
williamr@2
|
366 |
* i.e. an option level groups related options together.
|
williamr@2
|
367 |
* @param aOption Option value as an integer
|
williamr@2
|
368 |
* @return Any one of the system error codes, or KErrNone on success. */
|
williamr@2
|
369 |
virtual TInt SetOpt(TUint aOptionName,TUint aOptionLevel,TInt anOption) = 0;
|
williamr@2
|
370 |
|
williamr@2
|
371 |
/**
|
williamr@2
|
372 |
* Set a specific protocol/version to use.
|
williamr@2
|
373 |
*
|
williamr@2
|
374 |
* This method can be used to select a particular protocol version to use in
|
williamr@2
|
375 |
* implementations that support different protocols/versions.
|
williamr@2
|
376 |
* See individual implementation notes for details.
|
williamr@2
|
377 |
*
|
williamr@2
|
378 |
* @param aProtocol A reference to a descriptor containing the protocol name/version to use.
|
williamr@2
|
379 |
* @return KErrNone if successful, a system-wide error code if not. */
|
williamr@2
|
380 |
virtual TInt SetProtocol(const TDesC& aProtocol) = 0;
|
williamr@2
|
381 |
|
williamr@2
|
382 |
/**
|
williamr@2
|
383 |
* Set the server certificate.
|
williamr@2
|
384 |
*
|
williamr@2
|
385 |
* When acting in server mode, this method will set the certificate that is to be used
|
williamr@2
|
386 |
* as the server certificate.
|
williamr@2
|
387 |
* When acting in client mode, this method will perform no action, but will return KErrNotSupported.
|
williamr@2
|
388 |
*
|
williamr@2
|
389 |
* @param aCert The certificate to use.
|
williamr@2
|
390 |
* @return Any one of the system error codes, or KErrNone on success. */
|
williamr@2
|
391 |
virtual TInt SetServerCert(const CX509Certificate& aCert) = 0;
|
williamr@2
|
392 |
|
williamr@2
|
393 |
/**
|
williamr@2
|
394 |
* Start acting as a client and initiate a handshake with the remote server.
|
williamr@2
|
395 |
*
|
williamr@2
|
396 |
* This is an asynchronous call, and will only complete when the handshake completes
|
williamr@2
|
397 |
* and the secure connection is established, or it fails.
|
williamr@2
|
398 |
*
|
williamr@2
|
399 |
* @param aStatus On completion, any one of the system error codes, or KErrNone on success. */
|
williamr@2
|
400 |
virtual void StartClientHandshake(TRequestStatus& aStatus) = 0;
|
williamr@2
|
401 |
|
williamr@2
|
402 |
/**
|
williamr@2
|
403 |
* Start acting as a server and listen for a handshake from the remote client.
|
williamr@2
|
404 |
*
|
williamr@2
|
405 |
* This is an asynchronous call, and will only complete when a client completes the
|
williamr@2
|
406 |
* handshake, or if it fails. Normally, the socket passed in will usually have been
|
williamr@2
|
407 |
* previously used in a call to Accept() on a listening socket, but this is not required.
|
williamr@2
|
408 |
*
|
williamr@2
|
409 |
* @param aStatus On completion, any one of the system error codes, or KErrNone on success. */
|
williamr@2
|
410 |
virtual void StartServerHandshake(TRequestStatus& aStatus) = 0;
|
williamr@2
|
411 |
|
williamr@2
|
412 |
/** Standard destructor. */
|
williamr@2
|
413 |
virtual ~MSecureSocket() {};
|
williamr@2
|
414 |
|
williamr@2
|
415 |
};
|
williamr@2
|
416 |
|
williamr@2
|
417 |
#endif // __SECURESOCKETINTERFACE_H__
|
williamr@4
|
418 |
|