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

Side by Side Diff: tests/standalone/io/secure_server_client_certificate_test.dart

Issue 1663633003: Adds SecurityContext.setClientAuthoritiesBytes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 | « sdk/lib/io/security_context.dart ('k') | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import "dart:async"; 5 import "dart:async";
6 import "dart:io"; 6 import "dart:io";
7 7
8 import "package:async_helper/async_helper.dart"; 8 import "package:async_helper/async_helper.dart";
9 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
10 10
11 InternetAddress HOST; 11 InternetAddress HOST;
12 12
13 String localFile(path) => Platform.script.resolve(path).toFilePath(); 13 String localFile(path) => Platform.script.resolve(path).toFilePath();
14 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync(); 14 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync();
15 15
16 SecurityContext serverContext = new SecurityContext() 16 SecurityContext serverContext = new SecurityContext()
17 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem')) 17 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem'))
18 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'), 18 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'),
19 password: 'dartdart') 19 password: 'dartdart')
20 ..setTrustedCertificates(file: localFile('certificates/client_authority.pem')) 20 ..setTrustedCertificates(file: localFile('certificates/client_authority.pem'))
21 ..setClientAuthorities(localFile('certificates/client_authority.pem')); 21 ..setClientAuthoritiesBytes(
22 readLocalFile('certificates/client_authority.pem'));
22 23
23 SecurityContext clientCertContext = new SecurityContext() 24 SecurityContext clientCertContext = new SecurityContext()
24 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')) 25 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem'))
25 ..useCertificateChainBytes(readLocalFile('certificates/client1.pem')) 26 ..useCertificateChainBytes(readLocalFile('certificates/client1.pem'))
26 ..usePrivateKeyBytes(readLocalFile('certificates/client1_key.pem'), 27 ..usePrivateKeyBytes(readLocalFile('certificates/client1_key.pem'),
27 password: 'dartdart'); 28 password: 'dartdart');
28 29
29 SecurityContext clientNoCertContext = new SecurityContext() 30 SecurityContext clientNoCertContext = new SecurityContext()
30 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); 31 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem'));
31 32
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 69
69 main() async { 70 main() async {
70 asyncStart(); 71 asyncStart();
71 HOST = (await InternetAddress.lookup("localhost")).first; 72 HOST = (await InternetAddress.lookup("localhost")).first;
72 await testClientCertificate(required: false, sendCert: true); 73 await testClientCertificate(required: false, sendCert: true);
73 await testClientCertificate(required: true, sendCert: true); 74 await testClientCertificate(required: true, sendCert: true);
74 await testClientCertificate(required: false, sendCert: false); 75 await testClientCertificate(required: false, sendCert: false);
75 await testClientCertificate(required: true, sendCert: false); 76 await testClientCertificate(required: true, sendCert: false);
76 asyncEnd(); 77 asyncEnd();
77 } 78 }
OLDNEW
« no previous file with comments | « sdk/lib/io/security_context.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698