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

Unified Diff: webrtc/base/sslfingerprint.cc

Issue 2641633002: Only set certificate on DTLS transport if fingerprint is found in SDP. (Closed)
Patch Set: Fix tests by making FakeTransportController::Connect put fingerprints in transport descriptions. Created 3 years, 11 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 | « webrtc/base/sslfingerprint.h ('k') | webrtc/p2p/base/faketransportcontroller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/sslfingerprint.cc
diff --git a/webrtc/base/sslfingerprint.cc b/webrtc/base/sslfingerprint.cc
index 2c3e1e974be4517bc34cd8ba6f763ddf679da9c2..e172a2c304571b5e64e9b33c8052b46fc1f85eac 100644
--- a/webrtc/base/sslfingerprint.cc
+++ b/webrtc/base/sslfingerprint.cc
@@ -14,6 +14,7 @@
#include <string>
#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
#include "webrtc/base/messagedigest.h"
#include "webrtc/base/stringencode.h"
@@ -62,6 +63,22 @@ SSLFingerprint* SSLFingerprint::CreateFromRfc4572(
value_len);
}
+SSLFingerprint* SSLFingerprint::CreateFromCertificate(
+ const RTCCertificate* cert) {
+ std::string digest_alg;
+ if (!cert->ssl_certificate().GetSignatureDigestAlgorithm(&digest_alg)) {
+ LOG(LS_ERROR) << "Failed to retrieve the certificate's digest algorithm";
+ return nullptr;
+ }
+
+ SSLFingerprint* fingerprint = Create(digest_alg, cert->identity());
+ if (!fingerprint) {
+ LOG(LS_ERROR) << "Failed to create identity fingerprint, alg="
+ << digest_alg;
+ }
+ return fingerprint;
+}
+
SSLFingerprint::SSLFingerprint(const std::string& algorithm,
const uint8_t* digest_in,
size_t digest_len)
« no previous file with comments | « webrtc/base/sslfingerprint.h ('k') | webrtc/p2p/base/faketransportcontroller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698