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 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 bool wasInHandshake = _status != CONNECTED; | 1155 bool wasInHandshake = _status != CONNECTED; |
1156 List args = new List(2 + NUM_BUFFERS * 2); | 1156 List args = new List(2 + NUM_BUFFERS * 2); |
1157 args[0] = _filterPointer; | 1157 args[0] = _filterPointer; |
1158 args[1] = wasInHandshake; | 1158 args[1] = wasInHandshake; |
1159 var bufs = _secureFilter.buffers; | 1159 var bufs = _secureFilter.buffers; |
1160 for (var i = 0; i < NUM_BUFFERS; ++i) { | 1160 for (var i = 0; i < NUM_BUFFERS; ++i) { |
1161 args[2 * i + 2] = bufs[i].start; | 1161 args[2 * i + 2] = bufs[i].start; |
1162 args[2 * i + 3] = bufs[i].end; | 1162 args[2 * i + 3] = bufs[i].end; |
1163 } | 1163 } |
1164 | 1164 |
1165 return _IOService.dispatch(_SSL_PROCESS_FILTER, args).then((response) { | 1165 return _IOService._dispatch(_SSL_PROCESS_FILTER, args).then((response) { |
1166 if (response.length == 2) { | 1166 if (response.length == 2) { |
1167 _reportError(new TlsException('${response[1]} error ${response[0]}'), | 1167 _reportError(new TlsException('${response[1]} error ${response[0]}'), |
1168 null); | 1168 null); |
1169 } | 1169 } |
1170 int start(int index) => response[2 * index]; | 1170 int start(int index) => response[2 * index]; |
1171 int end(int index) => response[2 * index + 1]; | 1171 int end(int index) => response[2 * index + 1]; |
1172 | 1172 |
1173 _FilterStatus status = new _FilterStatus(); | 1173 _FilterStatus status = new _FilterStatus(); |
1174 // Compute writeEmpty as "write plaintext buffer and write encrypted | 1174 // Compute writeEmpty as "write plaintext buffer and write encrypted |
1175 // buffer were empty when we started and are empty now". | 1175 // buffer were empty when we started and are empty now". |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 /** | 1423 /** |
1424 * An exception that happens in the handshake phase of establishing | 1424 * An exception that happens in the handshake phase of establishing |
1425 * a secure network connection, when looking up or verifying a | 1425 * a secure network connection, when looking up or verifying a |
1426 * certificate. | 1426 * certificate. |
1427 */ | 1427 */ |
1428 class CertificateException extends TlsException { | 1428 class CertificateException extends TlsException { |
1429 const CertificateException([String message = "", | 1429 const CertificateException([String message = "", |
1430 OSError osError = null]) | 1430 OSError osError = null]) |
1431 : super._("CertificateException", message, osError); | 1431 : super._("CertificateException", message, osError); |
1432 } | 1432 } |
OLD | NEW |