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

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

Issue 1757453002: Rolls back fix of SecurityContext method names. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 | « CHANGELOG.md ('k') | sdk/lib/io/http.dart » ('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 void usePrivateKey(String file, {String password}) {
141 usePrivateKeySync(keyFile, password: password); 141 List<int> bytes = (new File(file)).readAsBytesSync();
142 }
143 void usePrivateKeySync(String keyFile, {String password}) {
144 List<int> bytes = (new File(keyFile)).readAsBytesSync();
145 usePrivateKeyBytes(bytes, password: password); 142 usePrivateKeyBytes(bytes, password: password);
146 } 143 }
147 void usePrivateKeyBytes(List<int> keyBytes, {String password}) 144 void usePrivateKeyBytes(List<int> keyBytes, {String password})
148 native "SecurityContext_UsePrivateKeyBytes"; 145 native "SecurityContext_UsePrivateKeyBytes";
149 146
150 void setTrustedCertificates(String file, {String password}) { 147 void setTrustedCertificates(String file, {String password}) {
151 setTrustedCertificatesSync(file, password: password);
152 }
153 void setTrustedCertificatesSync(String file, {String password}) {
154 List<int> bytes = (new File(file)).readAsBytesSync(); 148 List<int> bytes = (new File(file)).readAsBytesSync();
155 setTrustedCertificatesBytes(bytes, password: password); 149 setTrustedCertificatesBytes(bytes, password: password);
156 } 150 }
157 void setTrustedCertificatesBytes(List<int> certBytes, {String password}) 151 void setTrustedCertificatesBytes(List<int> certBytes, {String password})
158 native "SecurityContext_SetTrustedCertificatesBytes"; 152 native "SecurityContext_SetTrustedCertificatesBytes";
159 153
160 void useCertificateChain({String file, String directory, String password}) { 154 void useCertificateChain(String file, {String password}) {
161 if (directory != null) { 155 List<int> bytes = (new File(file)).readAsBytesSync();
162 throw new UnsupportedError(
163 "The directory argument to useCertificateChain is not supported.");
164 }
165 useCertificateChainSync(file, password: password);
166 }
167 void useCertificateChainSync(String chainFile, {String password}) {
168 List<int> bytes = (new File(chainFile)).readAsBytesSync();
169 useCertificateChainBytes(bytes, password: password); 156 useCertificateChainBytes(bytes, password: password);
170 } 157 }
171 void useCertificateChainBytes(List<int> chainBytes, {String password}) 158 void useCertificateChainBytes(List<int> chainBytes, {String password})
172 native "SecurityContext_UseCertificateChainBytes"; 159 native "SecurityContext_UseCertificateChainBytes";
173 160
174 void setClientAuthorities(String file, {String password}) { 161 void setClientAuthorities(String file, {String password}) {
175 setClientAuthoritiesSync(file, password: password);
176 }
177 void setClientAuthoritiesSync(String file, {String password}) {
178 List<int> bytes = (new File(file)).readAsBytesSync(); 162 List<int> bytes = (new File(file)).readAsBytesSync();
179 setClientAuthoritiesBytes(bytes, password: password); 163 setClientAuthoritiesBytes(bytes, password: password);
180 } 164 }
181 void setClientAuthoritiesBytes(List<int> authCertBytes, {String password}) 165 void setClientAuthoritiesBytes(List<int> authCertBytes, {String password})
182 native "SecurityContext_SetClientAuthoritiesBytes"; 166 native "SecurityContext_SetClientAuthoritiesBytes";
167
183 void setAlpnProtocols(List<String> protocols, bool isServer) { 168 void setAlpnProtocols(List<String> protocols, bool isServer) {
184 Uint8List encodedProtocols = 169 Uint8List encodedProtocols =
185 SecurityContext._protocolsToLengthEncoding(protocols); 170 SecurityContext._protocolsToLengthEncoding(protocols);
186 _setAlpnProtocols(encodedProtocols, isServer); 171 _setAlpnProtocols(encodedProtocols, isServer);
187 } 172 }
188 void _setAlpnProtocols(Uint8List protocols, bool isServer) 173 void _setAlpnProtocols(Uint8List protocols, bool isServer)
189 native "SecurityContext_SetAlpnProtocols"; 174 native "SecurityContext_SetAlpnProtocols";
190 void _trustBuiltinRoots() 175 void _trustBuiltinRoots()
191 native "SecurityContext_TrustBuiltinRoots"; 176 native "SecurityContext_TrustBuiltinRoots";
192 } 177 }
(...skipping 14 matching lines...) Expand all
207 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(), 192 return new DateTime.fromMillisecondsSinceEpoch(_startValidity(),
208 isUtc: true); 193 isUtc: true);
209 } 194 }
210 DateTime get endValidity { 195 DateTime get endValidity {
211 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), 196 return new DateTime.fromMillisecondsSinceEpoch(_endValidity(),
212 isUtc: true); 197 isUtc: true);
213 } 198 }
214 int _startValidity() native "X509_StartValidity"; 199 int _startValidity() native "X509_StartValidity";
215 int _endValidity() native "X509_EndValidity"; 200 int _endValidity() native "X509_EndValidity";
216 } 201 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | sdk/lib/io/http.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698