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

Side by Side 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, 10 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 implements SecurityContext { 130 implements SecurityContext {
131 _SecurityContext() { 131 _SecurityContext() {
132 _createNativeContext(); 132 _createNativeContext();
133 } 133 }
134 134
135 void _createNativeContext() native "SecurityContext_Allocate"; 135 void _createNativeContext() native "SecurityContext_Allocate";
136 136
137 static final SecurityContext defaultContext = 137 static final SecurityContext defaultContext =
138 new _SecurityContext().._trustBuiltinRoots(); 138 new _SecurityContext().._trustBuiltinRoots();
139 139
140 void usePrivateKey(String keyFile, {String password}) 140 Future usePrivateKey(String keyFile, {String password}) {
141 native "SecurityContext_UsePrivateKey"; 141 return (new File(keyFile)).readAsBytes().then((bytes) {
142 usePrivateKeyAsBytes(bytes, password: password);
143 });
144 }
145 void usePrivateKeyAsBytes(List<int> keyBytes, {String password})
146 native "SecurityContext_UsePrivateKeyAsBytes";
142 void setTrustedCertificates({String file, String directory}) 147 void setTrustedCertificates({String file, String directory})
143 native "SecurityContext_SetTrustedCertificates"; 148 native "SecurityContext_SetTrustedCertificates";
144 void useCertificateChain(String file) 149 void useCertificateChain(String file)
145 native "SecurityContext_UseCertificateChain"; 150 native "SecurityContext_UseCertificateChain";
146 void setClientAuthorities(String file) 151 void setClientAuthorities(String file)
147 native "SecurityContext_SetClientAuthorities"; 152 native "SecurityContext_SetClientAuthorities";
148 void setAlpnProtocols(List<String> protocols, bool isServer) { 153 void setAlpnProtocols(List<String> protocols, bool isServer) {
149 Uint8List encodedProtocols = 154 Uint8List encodedProtocols =
150 SecurityContext._protocolsToLengthEncoding(protocols); 155 SecurityContext._protocolsToLengthEncoding(protocols);
151 _setAlpnProtocols(encodedProtocols, isServer); 156 _setAlpnProtocols(encodedProtocols, isServer);
(...skipping 19 matching lines...) Expand all
171 DateTime get startValidity { 176 DateTime get startValidity {
172 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(), 177 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(),
173 isUtc: true); 178 isUtc: true);
174 } 179 }
175 DateTime get endValidity { 180 DateTime get endValidity {
176 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), 181 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(),
177 isUtc: true); 182 isUtc: true);
178 } 183 }
179 int _startValidity() native "X509_StartValidity"; 184 int _startValidity() native "X509_StartValidity";
180 int _endValidity() native "X509_EndValidity"; 185 int _endValidity() native "X509_EndValidity";
181 } 186 }
OLDNEW
« 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