CertificateInfoImpl tests

pull/35931/head
Gregory Cooke 10 months ago
parent ac56c759d1
commit 8475761173
  1. 2
      src/core/tsi/ssl_transport_security.cc
  2. 13
      test/core/security/grpc_tls_crl_provider_test.cc

@ -1012,7 +1012,7 @@ static int GetCrlFromProvider(X509_STORE_CTX* ctx, X509_CRL** crl_out,
absl::StatusOr<std::string> akid = grpc_core::AkidFromCertificate(cert);
std::string akid_to_use;
if (!akid.ok()) {
gpr_log(GPR_INFO, "Could not get certificate akid.");
gpr_log(GPR_INFO, "Could not get certificate authority key identifier.");
} else {
akid_to_use = *akid;
}

@ -284,6 +284,19 @@ TEST_F(DirectoryReloaderCrlProviderTest, WithBadInitialDirectoryStatus) {
EXPECT_EQ(reload_errors.size(), 1);
}
TEST(CertificateInfoImplTest, CanFetchValues) {
experimental::CertificateInfoImpl cert =
CertificateInfoImpl("issuer", "akid");
EXPECT_EQ(cert.Issuer(), "issuer");
EXPECT_EQ(cert.AuthorityKeyIdentifier(), "akid");
}
TEST(CertificateInfoImplTest, NoAkid) {
experimental::CertificateInfoImpl cert = CertificateInfoImpl("issuer");
EXPECT_EQ(cert.Issuer(), "issuer");
EXPECT_EQ(cert.AuthorityKeyIdentifier(), "");
}
} // namespace testing
} // namespace grpc_core

Loading…
Cancel
Save