| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 static final SecurityContext defaultContext = | 137 static final SecurityContext defaultContext = |
| 138 new _SecurityContext().._trustBuiltinRoots(); | 138 new _SecurityContext().._trustBuiltinRoots(); |
| 139 | 139 |
| 140 Future usePrivateKey(String keyFile, {String password}) { | 140 Future usePrivateKey(String keyFile, {String password}) { |
| 141 return (new File(keyFile)).readAsBytes().then((bytes) { | 141 return (new File(keyFile)).readAsBytes().then((bytes) { |
| 142 usePrivateKeyBytes(bytes, password: password); | 142 usePrivateKeyBytes(bytes, password: password); |
| 143 }); | 143 }); |
| 144 } | 144 } |
| 145 void usePrivateKeyBytes(List<int> keyBytes, {String password}) | 145 void usePrivateKeyBytes(List<int> keyBytes, {String password}) |
| 146 native "SecurityContext_UsePrivateKeyBytes"; | 146 native "SecurityContext_UsePrivateKeyBytes"; |
| 147 void setTrustedCertificates({String file, String directory}) | 147 Future setTrustedCertificates(String file) { |
| 148 native "SecurityContext_SetTrustedCertificates"; | 148 return (new File(file)).readAsBytes().then((bytes) { |
| 149 setTrustedCertificatesBytes(bytes); |
| 150 }); |
| 151 } |
| 152 void setTrustedCertificatesBytes(List<int> certBytes) |
| 153 native "SecurityContext_SetTrustedCertificatesBytes"; |
| 149 Future useCertificateChain(String chainFile) { | 154 Future useCertificateChain(String chainFile) { |
| 150 return (new File(chainFile)).readAsBytes().then((bytes) { | 155 return (new File(chainFile)).readAsBytes().then((bytes) { |
| 151 useCertificateChainBytes(bytes); | 156 useCertificateChainBytes(bytes); |
| 152 }); | 157 }); |
| 153 } | 158 } |
| 154 void useCertificateChainBytes(List<int> chainBytes) | 159 void useCertificateChainBytes(List<int> chainBytes) |
| 155 native "SecurityContext_UseCertificateChainBytes"; | 160 native "SecurityContext_UseCertificateChainBytes"; |
| 156 void setClientAuthorities(String file) | 161 void setClientAuthorities(String file) |
| 157 native "SecurityContext_SetClientAuthorities"; | 162 native "SecurityContext_SetClientAuthorities"; |
| 158 void setAlpnProtocols(List<String> protocols, bool isServer) { | 163 void setAlpnProtocols(List<String> protocols, bool isServer) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 182 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(), | 187 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(), |
| 183 isUtc: true); | 188 isUtc: true); |
| 184 } | 189 } |
| 185 DateTime get endValidity { | 190 DateTime get endValidity { |
| 186 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), | 191 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), |
| 187 isUtc: true); | 192 isUtc: true); |
| 188 } | 193 } |
| 189 int _startValidity() native "X509_StartValidity"; | 194 int _startValidity() native "X509_StartValidity"; |
| 190 int _endValidity() native "X509_EndValidity"; | 195 int _endValidity() native "X509_EndValidity"; |
| 191 } | 196 } |
| OLD | NEW |