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 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 bool wasInHandshake = _status != CONNECTED; | 990 bool wasInHandshake = _status != CONNECTED; |
991 List args = new List(2 + NUM_BUFFERS * 2); | 991 List args = new List(2 + NUM_BUFFERS * 2); |
992 args[0] = _filterPointer; | 992 args[0] = _filterPointer; |
993 args[1] = wasInHandshake; | 993 args[1] = wasInHandshake; |
994 var bufs = _secureFilter.buffers; | 994 var bufs = _secureFilter.buffers; |
995 for (var i = 0; i < NUM_BUFFERS; ++i) { | 995 for (var i = 0; i < NUM_BUFFERS; ++i) { |
996 args[2 * i + 2] = bufs[i].start; | 996 args[2 * i + 2] = bufs[i].start; |
997 args[2 * i + 3] = bufs[i].end; | 997 args[2 * i + 3] = bufs[i].end; |
998 } | 998 } |
999 | 999 |
1000 return IOService.dispatch(SSL_PROCESS_FILTER, args).then((response) { | 1000 return _IOService.dispatch(_SSL_PROCESS_FILTER, args).then((response) { |
1001 if (response.length == 2) { | 1001 if (response.length == 2) { |
1002 _reportError(new TlsException('${response[1]} error ${response[0]}')); | 1002 _reportError(new TlsException('${response[1]} error ${response[0]}')); |
1003 } | 1003 } |
1004 int start(int index) => response[2 * index]; | 1004 int start(int index) => response[2 * index]; |
1005 int end(int index) => response[2 * index + 1]; | 1005 int end(int index) => response[2 * index + 1]; |
1006 | 1006 |
1007 _FilterStatus status = new _FilterStatus(); | 1007 _FilterStatus status = new _FilterStatus(); |
1008 // Compute writeEmpty as "write plaintext buffer and write encrypted | 1008 // Compute writeEmpty as "write plaintext buffer and write encrypted |
1009 // buffer were empty when we started and are empty now". | 1009 // buffer were empty when we started and are empty now". |
1010 status.writeEmpty = bufs[WRITE_PLAINTEXT].isEmpty && | 1010 status.writeEmpty = bufs[WRITE_PLAINTEXT].isEmpty && |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 /** | 1264 /** |
1265 * An exception that happens in the handshake phase of establishing | 1265 * An exception that happens in the handshake phase of establishing |
1266 * a secure network connection, when looking up or verifying a | 1266 * a secure network connection, when looking up or verifying a |
1267 * certificate. | 1267 * certificate. |
1268 */ | 1268 */ |
1269 class CertificateException extends TlsException { | 1269 class CertificateException extends TlsException { |
1270 const CertificateException([String message = "", | 1270 const CertificateException([String message = "", |
1271 OSError osError = null]) | 1271 OSError osError = null]) |
1272 : super._("CertificateException", message, osError); | 1272 : super._("CertificateException", message, osError); |
1273 } | 1273 } |
OLD | NEW |