Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1667)

Unified Diff: runtime/bin/secure_socket_patch.dart

Issue 1616073004: Adds SecurityContext.usePrivateKeyBytes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/secure_socket.cc ('k') | runtime/bin/secure_socket_unsupported.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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";
-}
+}
« no previous file with comments | « runtime/bin/secure_socket.cc ('k') | runtime/bin/secure_socket_unsupported.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698