Index: runtime/bin/secure_socket_patch.dart |
diff --git a/runtime/bin/secure_socket_patch.dart b/runtime/bin/secure_socket_patch.dart |
index 8d0b6bc39c3eb2540a800c295d6343a14f4b87ca..108215838683036fc51ea43a22dc676bf48e5485 100644 |
--- a/runtime/bin/secure_socket_patch.dart |
+++ b/runtime/bin/secure_socket_patch.dart |
@@ -137,8 +137,13 @@ class _SecurityContext |
static final SecurityContext defaultContext = |
new _SecurityContext().._trustBuiltinRoots(); |
- void usePrivateKey(String keyFile, {String password}) |
- native "SecurityContext_UsePrivateKey"; |
+ Future usePrivateKey(String keyFile, {String password}) { |
+ return (new File(keyFile)).readAsBytes().then((bytes) { |
+ usePrivateKeyAsBytes(bytes, password: password); |
+ }); |
+ } |
+ void usePrivateKeyAsBytes(List<int> keyBytes, {String password}) |
+ native "SecurityContext_UsePrivateKeyAsBytes"; |
void setTrustedCertificates({String file, String directory}) |
native "SecurityContext_SetTrustedCertificates"; |
void useCertificateChain(String file) |
@@ -178,4 +183,4 @@ class _X509CertificateImpl extends NativeFieldWrapperClass1 |
} |
int _startValidity() native "X509_StartValidity"; |
int _endValidity() native "X509_EndValidity"; |
-} |
+} |