OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 /** | 7 /** |
8 * A high-level class for communicating securely over a TCP socket, using | 8 * A high-level class for communicating securely over a TCP socket, using |
9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an | 9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an |
10 * [IOSink] interface, making it ideal for using together with | 10 * [IOSink] interface, making it ideal for using together with |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 * See [connect] for more information on the arguments. | 244 * See [connect] for more information on the arguments. |
245 * | 245 * |
246 */ | 246 */ |
247 static Future<RawSecureSocket> secure( | 247 static Future<RawSecureSocket> secure( |
248 RawSocket socket, | 248 RawSocket socket, |
249 {StreamSubscription subscription, | 249 {StreamSubscription subscription, |
250 host, | 250 host, |
251 bool sendClientCertificate: false, | 251 bool sendClientCertificate: false, |
252 String certificateName, | 252 String certificateName, |
253 bool onBadCertificate(X509Certificate certificate)}) { | 253 bool onBadCertificate(X509Certificate certificate)}) { |
| 254 socket.readEventsEnabled = false; |
| 255 socket.writeEventsEnabled = false; |
254 return _RawSecureSocket.connect( | 256 return _RawSecureSocket.connect( |
255 host != null ? host : socket.address, | 257 host != null ? host : socket.address, |
256 socket.port, | 258 socket.port, |
257 certificateName, | 259 certificateName, |
258 is_server: false, | 260 is_server: false, |
259 socket: socket, | 261 socket: socket, |
260 subscription: subscription, | 262 subscription: subscription, |
261 sendClientCertificate: sendClientCertificate, | 263 sendClientCertificate: sendClientCertificate, |
262 onBadCertificate: onBadCertificate); | 264 onBadCertificate: onBadCertificate); |
263 } | 265 } |
(...skipping 19 matching lines...) Expand all Loading... |
283 * arguments. | 285 * arguments. |
284 * | 286 * |
285 */ | 287 */ |
286 static Future<RawSecureSocket> secureServer( | 288 static Future<RawSecureSocket> secureServer( |
287 RawSocket socket, | 289 RawSocket socket, |
288 String certificateName, | 290 String certificateName, |
289 {StreamSubscription subscription, | 291 {StreamSubscription subscription, |
290 List<int> carryOverData, | 292 List<int> carryOverData, |
291 bool requestClientCertificate: false, | 293 bool requestClientCertificate: false, |
292 bool requireClientCertificate: false}) { | 294 bool requireClientCertificate: false}) { |
| 295 socket.readEventsEnabled = false; |
| 296 socket.writeEventsEnabled = false; |
293 return _RawSecureSocket.connect( | 297 return _RawSecureSocket.connect( |
294 socket.remoteHost, | 298 socket.remoteHost, |
295 socket.remotePort, | 299 socket.remotePort, |
296 certificateName, | 300 certificateName, |
297 is_server: true, | 301 is_server: true, |
298 socket: socket, | 302 socket: socket, |
299 subscription: subscription, | 303 subscription: subscription, |
300 carryOverData: carryOverData, | 304 carryOverData: carryOverData, |
301 requestClientCertificate: requestClientCertificate, | 305 requestClientCertificate: requestClientCertificate, |
302 requireClientCertificate: requireClientCertificate); | 306 requireClientCertificate: requireClientCertificate); |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 void destroy(); | 965 void destroy(); |
962 void handshake(); | 966 void handshake(); |
963 void init(); | 967 void init(); |
964 X509Certificate get peerCertificate; | 968 X509Certificate get peerCertificate; |
965 int processBuffer(int bufferIndex); | 969 int processBuffer(int bufferIndex); |
966 void registerBadCertificateCallback(Function callback); | 970 void registerBadCertificateCallback(Function callback); |
967 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); | 971 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); |
968 | 972 |
969 List<_ExternalBuffer> get buffers; | 973 List<_ExternalBuffer> get buffers; |
970 } | 974 } |
OLD | NEW |