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

Unified Diff: runtime/bin/secure_socket.cc

Issue 1416843003: Add support for client certificates to Secure[Server]Socket (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comment Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/standalone/io/certificates/server_chain.pem » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/secure_socket.cc
diff --git a/runtime/bin/secure_socket.cc b/runtime/bin/secure_socket.cc
index d29e7cfc9c065f8c2608d1cb07acd29e6f410c92..4d3c67997e053a4c37c2baecaef10be542018780 100644
--- a/runtime/bin/secure_socket.cc
+++ b/runtime/bin/secure_socket.cc
@@ -433,7 +433,7 @@ void FUNCTION_NAME(SecurityContext_SetTrustedCertificates)(
directory = NULL;
} else {
Dart_ThrowException(DartUtils::NewDartArgumentError(
- "Directory argument to SecurityContext.usePrivateKey is not "
+ "Directory argument to SecurityContext.setTrustedCertificates is not "
"a String or null"));
}
@@ -910,9 +910,12 @@ void SSLFilter::Connect(const char* hostname,
SSL_set_ex_data(ssl_, filter_ssl_index, this);
if (is_server_) {
- // Do not request a client certificate.
- // TODO(24069): Allow server to request a client certificate, when desired.
- SSL_set_verify(ssl_, SSL_VERIFY_NONE, NULL);
+ int certificate_mode =
+ request_client_certificate ? SSL_VERIFY_PEER : SSL_VERIFY_NONE;
+ if (require_client_certificate) {
+ certificate_mode |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
+ }
+ SSL_set_verify(ssl_, certificate_mode, NULL);
} else {
SetAlpnProtocolList(protocols_handle, ssl_, NULL, false);
status = SSL_set_tlsext_host_name(ssl_, hostname);
@@ -948,19 +951,6 @@ void SSLFilter::Connect(const char* hostname,
if (SSL_LOG_STATUS) Log::Print("SSL_connect error: %d\n", error);
}
}
- if (is_server_) {
- if (request_client_certificate) {
- // TODO(24069): Handle client certificates on server side.
- Dart_ThrowException(DartUtils::NewDartArgumentError(
- "requestClientCertificate not implemented."));
- }
- } else { // Client.
- if (send_client_certificate) {
- // TODO(24070): Handle client certificates on client side.
- Dart_ThrowException(DartUtils::NewDartArgumentError(
- "sendClientCertificate not implemented."));
- }
- }
Handshake();
}
« no previous file with comments | « no previous file | tests/standalone/io/certificates/server_chain.pem » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698