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

Unified Diff: tests/standalone/io/secure_server_client_certificate_test.dart

Issue 11467004: Enable client certificates in SecureSocket and SecureServerSocket (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: tests/standalone/io/secure_server_client_certificate_test.dart
diff --git a/tests/standalone/io/secure_server_test.dart b/tests/standalone/io/secure_server_client_certificate_test.dart
similarity index 83%
copy from tests/standalone/io/secure_server_test.dart
copy to tests/standalone/io/secure_server_client_certificate_test.dart
index 89415483b9542d8d49b105715aacb69944818f6f..261c716f2129c3ffb8915e0c7e96b8deb541a6b4 100644
--- a/tests/standalone/io/secure_server_test.dart
+++ b/tests/standalone/io/secure_server_client_certificate_test.dart
@@ -26,6 +26,8 @@ class SecureTestServer {
void onConnection(Socket connection) {
connection.onConnect = () {
numConnections++;
+ var certificate = connection.peerCertificate;
+ Expect.isTrue(certificate.subject.contains("CN="));
};
String received = "";
connection.onData = () {
@@ -43,7 +45,11 @@ class SecureTestServer {
}
int start() {
- server = new SecureServerSocket(SERVER_ADDRESS, 0, 10, "CN=$HOST_NAME");
+ server = new SecureServerSocket(SERVER_ADDRESS,
+ 0,
+ 10,
+ "CN=$HOST_NAME",
+ requireClientCertificate: true);
Expect.isNotNull(server);
server.onConnection = onConnection;
server.onError = errorHandlerServer;
@@ -60,7 +66,7 @@ class SecureTestServer {
class SecureTestClient {
SecureTestClient(int this.port, String this.name) {
- socket = new SecureSocket(HOST_NAME, port);
+ socket = new SecureSocket(HOST_NAME, port, sendClientCertificate: true);
socket.onConnect = this.onConnect;
socket.onData = () {
reply = reply.concat(new String.fromCharCodes(socket.read()));
@@ -101,7 +107,8 @@ void main() {
Path scriptDir = new Path.fromNative(new Options().script).directoryPath;
Path certificateDatabase = scriptDir.append('pkcert');
SecureSocket.initialize(database: certificateDatabase.toNativePath(),
- password: 'dartdart');
+ password: 'dartdart',
+ useBuiltinRoots: false);
var server = new SecureTestServer();
int port = server.start();

Powered by Google App Engine
This is Rietveld 408576698