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

Unified Diff: net/quic/test_tools/crypto_test_utils.cc

Issue 2011983004: Add a new CryptoTestUtils::LeafCertHashForTesting for generating expected leaf cert hashes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@122750844
Patch Set: Created 4 years, 7 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 | « net/quic/test_tools/crypto_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/test_tools/crypto_test_utils.cc
diff --git a/net/quic/test_tools/crypto_test_utils.cc b/net/quic/test_tools/crypto_test_utils.cc
index 59270b25155c465727df54f7d78c3faf66b759bb..da8e31bc82c379969b5c8575bf3412792b0bdb6f 100644
--- a/net/quic/test_tools/crypto_test_utils.cc
+++ b/net/quic/test_tools/crypto_test_utils.cc
@@ -447,6 +447,25 @@ string CryptoTestUtils::GetValueForTag(const CryptoHandshakeMessage& message,
return it->second;
}
+uint64_t CryptoTestUtils::LeafCertHashForTesting() {
+ scoped_refptr<ProofSource::Chain> chain;
+ IPAddress server_ip;
+ string sig;
+ string cert_sct;
+ std::unique_ptr<ProofSource> proof_source(
+ CryptoTestUtils::ProofSourceForTesting());
+ if (!proof_source->GetProof(server_ip, "", "",
+ QuicSupportedVersions().front(), "", false,
+ &chain, &sig, &cert_sct) ||
+ chain->certs.empty()) {
+ DCHECK(false) << "Proof generation failed";
+ return 0;
+ }
+
+ return QuicUtils::FNV1a_64_Hash(chain->certs.at(0).c_str(),
+ chain->certs.at(0).length());
+}
+
class MockCommonCertSets : public CommonCertSets {
public:
MockCommonCertSets(StringPiece cert, uint64_t hash, uint32_t index)
« no previous file with comments | « net/quic/test_tools/crypto_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698