| 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 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 127 /* patch */ static bool get alpnSupported { |
| 128 return _SecurityContext.alpnSupported; |
| 129 } |
| 126 } | 130 } |
| 127 | 131 |
| 128 class _SecurityContext | 132 class _SecurityContext |
| 129 extends NativeFieldWrapperClass1 | 133 extends NativeFieldWrapperClass1 |
| 130 implements SecurityContext { | 134 implements SecurityContext { |
| 131 _SecurityContext() { | 135 _SecurityContext() { |
| 132 _createNativeContext(); | 136 _createNativeContext(); |
| 133 } | 137 } |
| 134 | 138 |
| 135 void _createNativeContext() native "SecurityContext_Allocate"; | 139 void _createNativeContext() native "SecurityContext_Allocate"; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 158 void useCertificateChainBytes(List<int> chainBytes, {String password}) | 162 void useCertificateChainBytes(List<int> chainBytes, {String password}) |
| 159 native "SecurityContext_UseCertificateChainBytes"; | 163 native "SecurityContext_UseCertificateChainBytes"; |
| 160 | 164 |
| 161 void setClientAuthorities(String file, {String password}) { | 165 void setClientAuthorities(String file, {String password}) { |
| 162 List<int> bytes = (new File(file)).readAsBytesSync(); | 166 List<int> bytes = (new File(file)).readAsBytesSync(); |
| 163 setClientAuthoritiesBytes(bytes, password: password); | 167 setClientAuthoritiesBytes(bytes, password: password); |
| 164 } | 168 } |
| 165 void setClientAuthoritiesBytes(List<int> authCertBytes, {String password}) | 169 void setClientAuthoritiesBytes(List<int> authCertBytes, {String password}) |
| 166 native "SecurityContext_SetClientAuthoritiesBytes"; | 170 native "SecurityContext_SetClientAuthoritiesBytes"; |
| 167 | 171 |
| 172 static bool get alpnSupported => _alpnSupported(); |
| 173 static bool _alpnSupported() native "SecurityContext_AlpnSupported"; |
| 168 void setAlpnProtocols(List<String> protocols, bool isServer) { | 174 void setAlpnProtocols(List<String> protocols, bool isServer) { |
| 169 Uint8List encodedProtocols = | 175 Uint8List encodedProtocols = |
| 170 SecurityContext._protocolsToLengthEncoding(protocols); | 176 SecurityContext._protocolsToLengthEncoding(protocols); |
| 171 _setAlpnProtocols(encodedProtocols, isServer); | 177 _setAlpnProtocols(encodedProtocols, isServer); |
| 172 } | 178 } |
| 173 void _setAlpnProtocols(Uint8List protocols, bool isServer) | 179 void _setAlpnProtocols(Uint8List protocols, bool isServer) |
| 174 native "SecurityContext_SetAlpnProtocols"; | 180 native "SecurityContext_SetAlpnProtocols"; |
| 175 void _trustBuiltinRoots() | 181 void _trustBuiltinRoots() |
| 176 native "SecurityContext_TrustBuiltinRoots"; | 182 native "SecurityContext_TrustBuiltinRoots"; |
| 177 } | 183 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 192 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(), | 198 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(), |
| 193 isUtc: true); | 199 isUtc: true); |
| 194 } | 200 } |
| 195 DateTime get endValidity { | 201 DateTime get endValidity { |
| 196 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), | 202 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), |
| 197 isUtc: true); | 203 isUtc: true); |
| 198 } | 204 } |
| 199 int _startValidity() native "X509_StartValidity"; | 205 int _startValidity() native "X509_StartValidity"; |
| 200 int _endValidity() native "X509_EndValidity"; | 206 int _endValidity() native "X509_EndValidity"; |
| 201 } | 207 } |
| OLD | NEW |