Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: sdk/lib/io/secure_socket.dart

Issue 1721283002: Implements secure sockets on Mac OS with SecureTransport API (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/secure_socket_unsupported.cc ('k') | sdk/lib/io/security_context.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 args[0] = _filterPointer; 963 args[0] = _filterPointer;
964 args[1] = wasInHandshake; 964 args[1] = wasInHandshake;
965 var bufs = _secureFilter.buffers; 965 var bufs = _secureFilter.buffers;
966 for (var i = 0; i < NUM_BUFFERS; ++i) { 966 for (var i = 0; i < NUM_BUFFERS; ++i) {
967 args[2 * i + 2] = bufs[i].start; 967 args[2 * i + 2] = bufs[i].start;
968 args[2 * i + 3] = bufs[i].end; 968 args[2 * i + 3] = bufs[i].end;
969 } 969 }
970 970
971 return _IOService._dispatch(_SSL_PROCESS_FILTER, args).then((response) { 971 return _IOService._dispatch(_SSL_PROCESS_FILTER, args).then((response) {
972 if (response.length == 2) { 972 if (response.length == 2) {
973 _reportError(new TlsException('${response[1]} error ${response[0]}'), 973 if (wasInHandshake) {
974 null); 974 // If we're in handshake, throw a handshake error.
975 _reportError(
976 new HandshakeException('${response[1]} error ${response[0]}'),
977 null);
978 } else {
979 // If we're connected, throw a TLS error.
980 _reportError(new TlsException('${response[1]} error ${response[0]}'),
981 null);
982 }
975 } 983 }
976 int start(int index) => response[2 * index]; 984 int start(int index) => response[2 * index];
977 int end(int index) => response[2 * index + 1]; 985 int end(int index) => response[2 * index + 1];
978 986
979 _FilterStatus status = new _FilterStatus(); 987 _FilterStatus status = new _FilterStatus();
980 // Compute writeEmpty as "write plaintext buffer and write encrypted 988 // Compute writeEmpty as "write plaintext buffer and write encrypted
981 // buffer were empty when we started and are empty now". 989 // buffer were empty when we started and are empty now".
982 status.writeEmpty = bufs[WRITE_PLAINTEXT].isEmpty && 990 status.writeEmpty = bufs[WRITE_PLAINTEXT].isEmpty &&
983 start(WRITE_ENCRYPTED) == end(WRITE_ENCRYPTED); 991 start(WRITE_ENCRYPTED) == end(WRITE_ENCRYPTED);
984 // If we were in handshake when this started, _writeEmpty may be false 992 // If we were in handshake when this started, _writeEmpty may be false
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 /** 1234 /**
1227 * An exception that happens in the handshake phase of establishing 1235 * An exception that happens in the handshake phase of establishing
1228 * a secure network connection, when looking up or verifying a 1236 * a secure network connection, when looking up or verifying a
1229 * certificate. 1237 * certificate.
1230 */ 1238 */
1231 class CertificateException extends TlsException { 1239 class CertificateException extends TlsException {
1232 const CertificateException([String message = "", 1240 const CertificateException([String message = "",
1233 OSError osError = null]) 1241 OSError osError = null])
1234 : super._("CertificateException", message, osError); 1242 : super._("CertificateException", message, osError);
1235 } 1243 }
OLDNEW
« no previous file with comments | « runtime/bin/secure_socket_unsupported.cc ('k') | sdk/lib/io/security_context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698