| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 void usePrivateKey(String keyFile, {String password}) { | 140 void usePrivateKey(String keyFile, {String password}) { |
| 141 usePrivateKeySync(keyFile, password: password); | 141 usePrivateKeySync(keyFile, password: password); |
| 142 } | 142 } |
| 143 void usePrivateKeySync(String keyFile, {String password}) { | 143 void usePrivateKeySync(String keyFile, {String password}) { |
| 144 List<int> bytes = (new File(keyFile)).readAsBytesSync(); | 144 List<int> bytes = (new File(keyFile)).readAsBytesSync(); |
| 145 usePrivateKeyBytes(bytes, password: password); | 145 usePrivateKeyBytes(bytes, password: password); |
| 146 } | 146 } |
| 147 void usePrivateKeyBytes(List<int> keyBytes, {String password}) | 147 void usePrivateKeyBytes(List<int> keyBytes, {String password}) |
| 148 native "SecurityContext_UsePrivateKeyBytes"; | 148 native "SecurityContext_UsePrivateKeyBytes"; |
| 149 | 149 |
| 150 void setTrustedCertificates(String file) { | 150 void setTrustedCertificates(String file, {String password}) { |
| 151 setTrustedCertificatesSync(file); | 151 setTrustedCertificatesSync(file, password: password); |
| 152 } | 152 } |
| 153 void setTrustedCertificatesSync(String file) { | 153 void setTrustedCertificatesSync(String file, {String password}) { |
| 154 List<int> bytes = (new File(file)).readAsBytesSync(); | 154 List<int> bytes = (new File(file)).readAsBytesSync(); |
| 155 setTrustedCertificatesBytes(bytes); | 155 setTrustedCertificatesBytes(bytes, password: password); |
| 156 } | 156 } |
| 157 void setTrustedCertificatesBytes(List<int> certBytes) | 157 void setTrustedCertificatesBytes(List<int> certBytes, {String password}) |
| 158 native "SecurityContext_SetTrustedCertificatesBytes"; | 158 native "SecurityContext_SetTrustedCertificatesBytes"; |
| 159 | 159 |
| 160 void useCertificateChain({String file, String directory}) { | 160 void useCertificateChain({String file, String directory, String password}) { |
| 161 if (directory != null) { | 161 if (directory != null) { |
| 162 throw new UnsupportedError( | 162 throw new UnsupportedError( |
| 163 "The directory argument to useCertificateChain is not supported."); | 163 "The directory argument to useCertificateChain is not supported."); |
| 164 } | 164 } |
| 165 useCertificateChainSync(file); | 165 useCertificateChainSync(file, password: password); |
| 166 } | 166 } |
| 167 void useCertificateChainSync(String chainFile) { | 167 void useCertificateChainSync(String chainFile, {String password}) { |
| 168 List<int> bytes = (new File(chainFile)).readAsBytesSync(); | 168 List<int> bytes = (new File(chainFile)).readAsBytesSync(); |
| 169 useCertificateChainBytes(bytes); | 169 useCertificateChainBytes(bytes, password: password); |
| 170 } | 170 } |
| 171 void useCertificateChainBytes(List<int> chainBytes) | 171 void useCertificateChainBytes(List<int> chainBytes, {String password}) |
| 172 native "SecurityContext_UseCertificateChainBytes"; | 172 native "SecurityContext_UseCertificateChainBytes"; |
| 173 | 173 |
| 174 void setClientAuthorities(String file) { | 174 void setClientAuthorities(String file, {String password}) { |
| 175 setClientAuthoritiesSync(file); | 175 setClientAuthoritiesSync(file, password: password); |
| 176 } | 176 } |
| 177 void setClientAuthoritiesSync(String file) { | 177 void setClientAuthoritiesSync(String file, {String password}) { |
| 178 List<int> bytes = (new File(file)).readAsBytesSync(); | 178 List<int> bytes = (new File(file)).readAsBytesSync(); |
| 179 setClientAuthoritiesBytes(bytes); | 179 setClientAuthoritiesBytes(bytes, password: password); |
| 180 } | 180 } |
| 181 void setClientAuthoritiesBytes(List<int> authCertBytes) | 181 void setClientAuthoritiesBytes(List<int> authCertBytes, {String password}) |
| 182 native "SecurityContext_SetClientAuthoritiesBytes"; | 182 native "SecurityContext_SetClientAuthoritiesBytes"; |
| 183 void setAlpnProtocols(List<String> protocols, bool isServer) { | 183 void setAlpnProtocols(List<String> protocols, bool isServer) { |
| 184 Uint8List encodedProtocols = | 184 Uint8List encodedProtocols = |
| 185 SecurityContext._protocolsToLengthEncoding(protocols); | 185 SecurityContext._protocolsToLengthEncoding(protocols); |
| 186 _setAlpnProtocols(encodedProtocols, isServer); | 186 _setAlpnProtocols(encodedProtocols, isServer); |
| 187 } | 187 } |
| 188 void _setAlpnProtocols(Uint8List protocols, bool isServer) | 188 void _setAlpnProtocols(Uint8List protocols, bool isServer) |
| 189 native "SecurityContext_SetAlpnProtocols"; | 189 native "SecurityContext_SetAlpnProtocols"; |
| 190 void _trustBuiltinRoots() | 190 void _trustBuiltinRoots() |
| 191 native "SecurityContext_TrustBuiltinRoots"; | 191 native "SecurityContext_TrustBuiltinRoots"; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 207 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(), | 207 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(), |
| 208 isUtc: true); | 208 isUtc: true); |
| 209 } | 209 } |
| 210 DateTime get endValidity { | 210 DateTime get endValidity { |
| 211 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), | 211 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), |
| 212 isUtc: true); | 212 isUtc: true); |
| 213 } | 213 } |
| 214 int _startValidity() native "X509_StartValidity"; | 214 int _startValidity() native "X509_StartValidity"; |
| 215 int _endValidity() native "X509_EndValidity"; | 215 int _endValidity() native "X509_EndValidity"; |
| 216 } | 216 } |
| OLD | NEW |