9 #include <gmock/gmock.h> 10 #include <gtest/gtest.h> 17 using namespace folly;
30 std::vector<std::string> alts,
31 std::vector<SignatureScheme> schemes) {
32 auto cert = std::make_shared<MockSelfCert>();
33 ON_CALL(*cert, getIdentity()).WillByDefault(
Return(identity));
34 ON_CALL(*cert, getAltIdentities()).WillByDefault(
Return(alts));
35 ON_CALL(*cert, getSigSchemes()).WillByDefault(
Return(schemes));
44 manager_.addCert(cert,
true);
51 manager_.addCert(cert,
true);
58 manager_.addCert(cert,
true);
65 manager_.addCert(cert,
true);
79 manager_.addCert(cert);
81 auto res = manager_.getCert(
88 res = manager_.getCert(
93 EXPECT_EQ(res->second, SignatureScheme::rsa_pss_sha512);
99 manager_.addCert(cert1);
100 manager_.addCert(cert2);
102 auto res = manager_.getCert(
105 {SignatureScheme::rsa_pss_sha512});
107 EXPECT_EQ(res->second, SignatureScheme::rsa_pss_sha512);
113 manager_.addCert(cert1);
114 manager_.addCert(cert2);
116 auto res = manager_.getCert(
119 {SignatureScheme::rsa_pss_sha512});
121 EXPECT_EQ(res->second, SignatureScheme::rsa_pss_sha512);
126 manager_.addCert(cert);
128 auto res = manager_.getCert(
139 {
"www.test.com",
"www.example.com",
"*.example.com"},
141 manager_.addCert(cert);
155 manager_.addCert(cert);
167 manager_.addCert(cert1);
168 manager_.addCert(cert2);
176 manager_.addCert(cert);
185 auto cert =
getCert(
"*.test.com", {
"www.example.com"},
kRsa);
186 manager_.addCert(cert);
188 EXPECT_EQ(manager_.getCert(
"*.test.com"), cert);
189 EXPECT_EQ(manager_.getCert(
"www.example.com"),
nullptr);
190 EXPECT_EQ(manager_.getCert(
"foo.test.com"),
nullptr);
191 EXPECT_EQ(manager_.getCert(
"www.blah.com"),
nullptr);
static const std::vector< SignatureScheme > kRsa
#define EXPECT_EQ(val1, val2)
std::shared_ptr< MockSelfCert > getCert(std::string identity, std::vector< std::string > alts, std::vector< SignatureScheme > schemes)
—— Concurrent Priority Queue Implementation ——
folly::ssl::X509UniquePtr getCert(folly::StringPiece cert)
#define ON_CALL(obj, call)
TEST_F(RSAPSSTest, TestSignVerify)
#define EXPECT_FALSE(condition)
internal::ReturnAction< R > Return(R value)