| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 native "SecurityContext_UsePrivateKeyBytes"; | 146 native "SecurityContext_UsePrivateKeyBytes"; |
| 147 void setTrustedCertificates({String file, String directory}) | 147 void setTrustedCertificates({String file, String directory}) |
| 148 native "SecurityContext_SetTrustedCertificates"; | 148 native "SecurityContext_SetTrustedCertificates"; |
| 149 Future useCertificateChain(String chainFile) { | 149 Future useCertificateChain(String chainFile) { |
| 150 return (new File(chainFile)).readAsBytes().then((bytes) { | 150 return (new File(chainFile)).readAsBytes().then((bytes) { |
| 151 useCertificateChainBytes(bytes); | 151 useCertificateChainBytes(bytes); |
| 152 }); | 152 }); |
| 153 } | 153 } |
| 154 void useCertificateChainBytes(List<int> chainBytes) | 154 void useCertificateChainBytes(List<int> chainBytes) |
| 155 native "SecurityContext_UseCertificateChainBytes"; | 155 native "SecurityContext_UseCertificateChainBytes"; |
| 156 void setClientAuthorities(String file) | 156 void setClientAuthoritiesSync(String file) { |
| 157 native "SecurityContext_SetClientAuthorities"; | 157 List<int> bytes = (new File(file)).readAsBytesSync(); |
| 158 setClientAuthoritiesBytes(bytes); |
| 159 } |
| 160 void setClientAuthoritiesBytes(List<int> authCertBytes) |
| 161 native "SecurityContext_SetClientAuthoritiesBytes"; |
| 158 void setAlpnProtocols(List<String> protocols, bool isServer) { | 162 void setAlpnProtocols(List<String> protocols, bool isServer) { |
| 159 Uint8List encodedProtocols = | 163 Uint8List encodedProtocols = |
| 160 SecurityContext._protocolsToLengthEncoding(protocols); | 164 SecurityContext._protocolsToLengthEncoding(protocols); |
| 161 _setAlpnProtocols(encodedProtocols, isServer); | 165 _setAlpnProtocols(encodedProtocols, isServer); |
| 162 } | 166 } |
| 163 void _setAlpnProtocols(Uint8List protocols, bool isServer) | 167 void _setAlpnProtocols(Uint8List protocols, bool isServer) |
| 164 native "SecurityContext_SetAlpnProtocols"; | 168 native "SecurityContext_SetAlpnProtocols"; |
| 165 void _trustBuiltinRoots() | 169 void _trustBuiltinRoots() |
| 166 native "SecurityContext_TrustBuiltinRoots"; | 170 native "SecurityContext_TrustBuiltinRoots"; |
| 167 } | 171 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 182 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(), | 186 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(), |
| 183 isUtc: true); | 187 isUtc: true); |
| 184 } | 188 } |
| 185 DateTime get endValidity { | 189 DateTime get endValidity { |
| 186 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), | 190 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), |
| 187 isUtc: true); | 191 isUtc: true); |
| 188 } | 192 } |
| 189 int _startValidity() native "X509_StartValidity"; | 193 int _startValidity() native "X509_StartValidity"; |
| 190 int _endValidity() native "X509_EndValidity"; | 194 int _endValidity() native "X509_EndValidity"; |
| 191 } | 195 } |
| OLD | NEW |