OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 patch class SecureSocket { | 5 @patch class SecureSocket { |
6 /* patch */ factory SecureSocket._(RawSecureSocket rawSocket) => | 6 /* @patch */ factory SecureSocket._(RawSecureSocket rawSocket) => |
7 new _SecureSocket(rawSocket); | 7 new _SecureSocket(rawSocket); |
8 } | 8 } |
9 | 9 |
10 | 10 |
11 patch class _SecureFilter { | 11 @patch class _SecureFilter { |
12 /* patch */ factory _SecureFilter() => new _SecureFilterImpl(); | 12 /* @patch */ factory _SecureFilter() => new _SecureFilterImpl(); |
13 } | 13 } |
14 | 14 |
15 patch class X509Certificate { | 15 @patch class X509Certificate { |
16 /* patch */ factory X509Certificate._() => new _X509CertificateImpl(); | 16 /* @patch */ factory X509Certificate._() => new _X509CertificateImpl(); |
17 } | 17 } |
18 | 18 |
19 class _SecureSocket extends _Socket implements SecureSocket { | 19 class _SecureSocket extends _Socket implements SecureSocket { |
20 _SecureSocket(RawSecureSocket raw) : super(raw); | 20 _SecureSocket(RawSecureSocket raw) : super(raw); |
21 | 21 |
22 void set onBadCertificate(bool callback(X509Certificate certificate)) { | 22 void set onBadCertificate(bool callback(X509Certificate certificate)) { |
23 if (_raw == null) { | 23 if (_raw == null) { |
24 throw new StateError("onBadCertificate called on destroyed SecureSocket"); | 24 throw new StateError("onBadCertificate called on destroyed SecureSocket"); |
25 } | 25 } |
26 _raw.onBadCertificate = callback; | 26 _raw.onBadCertificate = callback; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler) | 109 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler) |
110 native "SecureSocket_RegisterHandshakeCompleteCallback"; | 110 native "SecureSocket_RegisterHandshakeCompleteCallback"; |
111 | 111 |
112 // This is a security issue, as it exposes a raw pointer to Dart code. | 112 // This is a security issue, as it exposes a raw pointer to Dart code. |
113 int _pointer() native "SecureSocket_FilterPointer"; | 113 int _pointer() native "SecureSocket_FilterPointer"; |
114 | 114 |
115 List<_ExternalBuffer> buffers; | 115 List<_ExternalBuffer> buffers; |
116 } | 116 } |
117 | 117 |
118 patch class SecurityContext { | 118 @patch class SecurityContext { |
119 /* patch */ factory SecurityContext() { | 119 /* @patch */ factory SecurityContext() { |
120 return new _SecurityContext(); | 120 return new _SecurityContext(); |
121 } | 121 } |
122 | 122 |
123 /* patch */ static SecurityContext get defaultContext { | 123 /* @patch */ static SecurityContext get defaultContext { |
124 return _SecurityContext.defaultContext; | 124 return _SecurityContext.defaultContext; |
125 } | 125 } |
126 | 126 |
127 /* patch */ static bool get alpnSupported { | 127 /* @patch */ static bool get alpnSupported { |
128 return _SecurityContext.alpnSupported; | 128 return _SecurityContext.alpnSupported; |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 class _SecurityContext | 132 class _SecurityContext |
133 extends NativeFieldWrapperClass1 | 133 extends NativeFieldWrapperClass1 |
134 implements SecurityContext { | 134 implements SecurityContext { |
135 _SecurityContext() { | 135 _SecurityContext() { |
136 _createNativeContext(); | 136 _createNativeContext(); |
137 } | 137 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(), | 198 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(), |
199 isUtc: true); | 199 isUtc: true); |
200 } | 200 } |
201 DateTime get endValidity { | 201 DateTime get endValidity { |
202 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), | 202 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), |
203 isUtc: true); | 203 isUtc: true); |
204 } | 204 } |
205 int _startValidity() native "X509_StartValidity"; | 205 int _startValidity() native "X509_StartValidity"; |
206 int _endValidity() native "X509_EndValidity"; | 206 int _endValidity() native "X509_EndValidity"; |
207 } | 207 } |
OLD | NEW |