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

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

Issue 1420923006: Add unique serial numbers to sample X509 certificates. Remove the "sendClientCertificate" parameter… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Delete all certificate signing private keys, so testers aren't vulnerable. Created 5 years, 1 month 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
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
(...skipping 14 matching lines...) Expand all
25 ..usePrivateKey(localFile('certificates/client1_key.pem'), 25 ..usePrivateKey(localFile('certificates/client1_key.pem'),
26 password: 'dartdart'); 26 password: 'dartdart');
27 27
28 SecurityContext clientNoCertContext = new SecurityContext() 28 SecurityContext clientNoCertContext = new SecurityContext()
29 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); 29 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem'));
30 30
31 Future testClientCertificate({bool required, bool sendCert}) async { 31 Future testClientCertificate({bool required, bool sendCert}) async {
32 var server = await SecureServerSocket.bind(HOST, 0, serverContext, 32 var server = await SecureServerSocket.bind(HOST, 0, serverContext,
33 requestClientCertificate: true, requireClientCertificate: required); 33 requestClientCertificate: true, requireClientCertificate: required);
34 var clientContext = sendCert ? clientCertContext : clientNoCertContext; 34 var clientContext = sendCert ? clientCertContext : clientNoCertContext;
35 var clientEndFuture = SecureSocket.connect(HOST, server.port, 35 var clientEndFuture =
36 context: clientContext, sendClientCertificate: true); 36 SecureSocket.connect(HOST, server.port, context: clientContext);
37 if (required && !sendCert) { 37 if (required && !sendCert) {
38 try { 38 try {
39 await server.first; 39 await server.first;
40 } catch (e) { 40 } catch (e) {
41 try { 41 try {
42 await clientEndFuture; 42 await clientEndFuture;
43 } catch (e) { 43 } catch (e) {
44 return; 44 return;
45 } 45 }
46 } 46 }
(...skipping 20 matching lines...) Expand all
67 67
68 main() async { 68 main() async {
69 asyncStart(); 69 asyncStart();
70 HOST = (await InternetAddress.lookup("localhost")).first; 70 HOST = (await InternetAddress.lookup("localhost")).first;
71 await testClientCertificate(required: false, sendCert: true); 71 await testClientCertificate(required: false, sendCert: true);
72 await testClientCertificate(required: true, sendCert: true); 72 await testClientCertificate(required: true, sendCert: true);
73 await testClientCertificate(required: false, sendCert: false); 73 await testClientCertificate(required: false, sendCert: false);
74 await testClientCertificate(required: true, sendCert: false); 74 await testClientCertificate(required: true, sendCert: false);
75 asyncEnd(); 75 asyncEnd();
76 } 76 }
OLDNEW
« no previous file with comments | « tests/standalone/io/create_sample_certificates.sh ('k') | tests/standalone/io/secure_socket_renegotiate_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698