| 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 | 5 @patch |
| 6 class SecureSocket { | 6 class SecureSocket { |
| 7 @patch | 7 @patch |
| 8 factory SecureSocket._(RawSecureSocket rawSocket) => | 8 factory SecureSocket._(RawSecureSocket rawSocket) => |
| 9 new _SecureSocket(rawSocket); | 9 new _SecureSocket(rawSocket); |
| 10 } | 10 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 class SecurityContext { | 122 class SecurityContext { |
| 123 @patch | 123 @patch |
| 124 factory SecurityContext() { | 124 factory SecurityContext() { |
| 125 return new _SecurityContext(); | 125 return new _SecurityContext(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 @patch | 128 @patch |
| 129 static SecurityContext get defaultContext { | 129 static SecurityContext get defaultContext { |
| 130 return _SecurityContext.defaultContext; | 130 return _SecurityContext.defaultContext; |
| 131 } | 131 } |
| 132 | |
| 133 @patch | |
| 134 static bool get alpnSupported { | |
| 135 return _SecurityContext.alpnSupported; | |
| 136 } | |
| 137 } | 132 } |
| 138 | 133 |
| 139 class _SecurityContext extends NativeFieldWrapperClass1 | 134 class _SecurityContext extends NativeFieldWrapperClass1 |
| 140 implements SecurityContext { | 135 implements SecurityContext { |
| 141 _SecurityContext() { | 136 _SecurityContext() { |
| 142 _createNativeContext(); | 137 _createNativeContext(); |
| 143 } | 138 } |
| 144 | 139 |
| 145 void _createNativeContext() native "SecurityContext_Allocate"; | 140 void _createNativeContext() native "SecurityContext_Allocate"; |
| 146 | 141 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 172 native "SecurityContext_UseCertificateChainBytes"; | 167 native "SecurityContext_UseCertificateChainBytes"; |
| 173 | 168 |
| 174 void setClientAuthorities(String file, {String password}) { | 169 void setClientAuthorities(String file, {String password}) { |
| 175 List<int> bytes = (new File(file)).readAsBytesSync(); | 170 List<int> bytes = (new File(file)).readAsBytesSync(); |
| 176 setClientAuthoritiesBytes(bytes, password: password); | 171 setClientAuthoritiesBytes(bytes, password: password); |
| 177 } | 172 } |
| 178 | 173 |
| 179 void setClientAuthoritiesBytes(List<int> authCertBytes, {String password}) | 174 void setClientAuthoritiesBytes(List<int> authCertBytes, {String password}) |
| 180 native "SecurityContext_SetClientAuthoritiesBytes"; | 175 native "SecurityContext_SetClientAuthoritiesBytes"; |
| 181 | 176 |
| 182 static bool get alpnSupported => _alpnSupported(); | |
| 183 static bool _alpnSupported() native "SecurityContext_AlpnSupported"; | |
| 184 void setAlpnProtocols(List<String> protocols, bool isServer) { | 177 void setAlpnProtocols(List<String> protocols, bool isServer) { |
| 185 Uint8List encodedProtocols = | 178 Uint8List encodedProtocols = |
| 186 SecurityContext._protocolsToLengthEncoding(protocols); | 179 SecurityContext._protocolsToLengthEncoding(protocols); |
| 187 _setAlpnProtocols(encodedProtocols, isServer); | 180 _setAlpnProtocols(encodedProtocols, isServer); |
| 188 } | 181 } |
| 189 | 182 |
| 190 void _setAlpnProtocols(Uint8List protocols, bool isServer) | 183 void _setAlpnProtocols(Uint8List protocols, bool isServer) |
| 191 native "SecurityContext_SetAlpnProtocols"; | 184 native "SecurityContext_SetAlpnProtocols"; |
| 192 void _trustBuiltinRoots() native "SecurityContext_TrustBuiltinRoots"; | 185 void _trustBuiltinRoots() native "SecurityContext_TrustBuiltinRoots"; |
| 193 } | 186 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 209 isUtc: true); | 202 isUtc: true); |
| 210 } | 203 } |
| 211 | 204 |
| 212 DateTime get endValidity { | 205 DateTime get endValidity { |
| 213 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), isUtc: true); | 206 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), isUtc: true); |
| 214 } | 207 } |
| 215 | 208 |
| 216 int _startValidity() native "X509_StartValidity"; | 209 int _startValidity() native "X509_StartValidity"; |
| 217 int _endValidity() native "X509_EndValidity"; | 210 int _endValidity() native "X509_EndValidity"; |
| 218 } | 211 } |
| OLD | NEW |