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

Side by Side Diff: tests/standalone/io/secure_socket_renegotiate_test.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
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 // This test verifies that client certificates work, if the client and server 5 // This test verifies that client certificates work, if the client and server
6 // are in separate processes, and that connection renegotiation works, and 6 // are in separate processes, and that connection renegotiation works, and
7 // can request a client certificate to be sent. 7 // can request a client certificate to be sent.
8 8
9 import "dart:async"; 9 import "dart:async";
10 import "dart:convert"; 10 import "dart:convert";
11 import "dart:io"; 11 import "dart:io";
12 12
13 import "package:expect/expect.dart"; 13 import "package:expect/expect.dart";
14 import "package:path/path.dart"; 14 import "package:path/path.dart";
15 15
16 const HOST_NAME = "localhost"; 16 const HOST_NAME = "localhost";
17 String localFile(path) => Platform.script.resolve(path).toFilePath(); 17 String localFile(path) => Platform.script.resolve(path).toFilePath();
18 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync(); 18 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync();
19 19
20 SecurityContext serverContext = new SecurityContext() 20 SecurityContext serverContext = new SecurityContext()
21 ..useCertificateChain(localFile('certificates/server_chain.pem')) 21 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem'))
22 ..usePrivateKeyAsBytes(readLocalFile('certificates/server_key.pem'), 22 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'),
23 password: 'dartdart'); 23 password: 'dartdart');
24 24
25 Future<SecureServerSocket> runServer() { 25 Future<SecureServerSocket> runServer() {
26 return SecureServerSocket.bind(HOST_NAME, 0, serverContext) 26 return SecureServerSocket.bind(HOST_NAME, 0, serverContext)
27 .then((SecureServerSocket server) { 27 .then((SecureServerSocket server) {
28 server.listen((SecureSocket socket) { 28 server.listen((SecureSocket socket) {
29 Expect.isNull(socket.peerCertificate); 29 Expect.isNull(socket.peerCertificate);
30 30
31 StreamIterator<String> input = 31 StreamIterator<String> input =
32 new StreamIterator(socket.transform(UTF8.decoder) 32 new StreamIterator(socket.transform(UTF8.decoder)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 if (result.exitCode != 0) { 75 if (result.exitCode != 0) {
76 print("Client failed, stdout:"); 76 print("Client failed, stdout:");
77 print(result.stdout); 77 print(result.stdout);
78 print(" stderr:"); 78 print(" stderr:");
79 print(result.stderr); 79 print(result.stderr);
80 Expect.fail('Client subprocess exit code: ${result.exitCode}'); 80 Expect.fail('Client subprocess exit code: ${result.exitCode}');
81 } 81 }
82 }); 82 });
83 }); 83 });
84 } 84 }
OLDNEW
« no previous file with comments | « tests/standalone/io/secure_socket_alpn_test.dart ('k') | tests/standalone/io/secure_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698