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

Side by Side Diff: runtime/bin/secure_socket_patch.dart

Issue 1648793005: Adds SecurityContext.useCertificateChainBytes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: *AsBytes -> *Bytes 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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 usePrivateKeyAsBytes(bytes, password: password); 142 usePrivateKeyBytes(bytes, password: password);
143 }); 143 });
144 } 144 }
145 void usePrivateKeyAsBytes(List<int> keyBytes, {String password}) 145 void usePrivateKeyBytes(List<int> keyBytes, {String password})
146 native "SecurityContext_UsePrivateKeyAsBytes"; 146 native "SecurityContext_UsePrivateKeyBytes";
147 void setTrustedCertificates({String file, String directory}) 147 void setTrustedCertificates({String file, String directory})
148 native "SecurityContext_SetTrustedCertificates"; 148 native "SecurityContext_SetTrustedCertificates";
149 void useCertificateChain(String file) 149 Future useCertificateChain(String chainFile) {
150 native "SecurityContext_UseCertificateChain"; 150 return (new File(chainFile)).readAsBytes().then((bytes) {
151 useCertificateChainBytes(bytes);
152 });
153 }
154 void useCertificateChainBytes(List<int> chainBytes)
155 native "SecurityContext_UseCertificateChainBytes";
151 void setClientAuthorities(String file) 156 void setClientAuthorities(String file)
152 native "SecurityContext_SetClientAuthorities"; 157 native "SecurityContext_SetClientAuthorities";
153 void setAlpnProtocols(List<String> protocols, bool isServer) { 158 void setAlpnProtocols(List<String> protocols, bool isServer) {
154 Uint8List encodedProtocols = 159 Uint8List encodedProtocols =
155 SecurityContext._protocolsToLengthEncoding(protocols); 160 SecurityContext._protocolsToLengthEncoding(protocols);
156 _setAlpnProtocols(encodedProtocols, isServer); 161 _setAlpnProtocols(encodedProtocols, isServer);
157 } 162 }
158 void _setAlpnProtocols(Uint8List protocols, bool isServer) 163 void _setAlpnProtocols(Uint8List protocols, bool isServer)
159 native "SecurityContext_SetAlpnProtocols"; 164 native "SecurityContext_SetAlpnProtocols";
160 void _trustBuiltinRoots() 165 void _trustBuiltinRoots()
(...skipping 16 matching lines...) Expand all
177 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(), 182 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(),
178 isUtc: true); 183 isUtc: true);
179 } 184 }
180 DateTime get endValidity { 185 DateTime get endValidity {
181 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), 186 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(),
182 isUtc: true); 187 isUtc: true);
183 } 188 }
184 int _startValidity() native "X509_StartValidity"; 189 int _startValidity() native "X509_StartValidity";
185 int _endValidity() native "X509_EndValidity"; 190 int _endValidity() native "X509_EndValidity";
186 } 191 }
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