#include "cast/sender/channel/cast_auth_util.h"
#include <openssl/x509.h>
#include <memory>
#include <string>
#include <utility>
#include "cast/common/certificate/cast_cert_validator.h"
#include "cast/common/certificate/cast_crl.h"
#include "cast/common/certificate/date_time.h"
#include "cast/common/certificate/proto/test_suite.pb.h"
#include "cast/common/certificate/testing/test_helpers.h"
#include "cast/common/channel/proto/cast_channel.pb.h"
#include "cast/common/public/trust_store.h"
#include "gtest/gtest.h"
#include "platform/api/time.h"
#include "platform/test/paths.h"
#include "util/crypto/pem_helpers.h"
#include "util/osp_logging.h"
#include "util/read_file.h"
#include "util/span_util.h"
namespace openscreen::cast {
namespace {
AuthResponse;
std::unique_ptr<ParsedCertificate> ParseX509Der(const std::string& der) { … }
bool ConvertTimeSeconds(const DateTime& time, uint64_t* seconds) { … }
const std::string& GetSpecificTestDataPath() { … }
class CastAuthUtilTest : public ::testing::Test { … };
TEST_F(CastAuthUtilTest, VerifySuccess) { … }
TEST_F(CastAuthUtilTest, VerifyBadCA) { … }
TEST_F(CastAuthUtilTest, VerifyBadClientAuthCert) { … }
TEST_F(CastAuthUtilTest, VerifyBadSignature) { … }
TEST_F(CastAuthUtilTest, VerifyEmptySignature) { … }
TEST_F(CastAuthUtilTest, VerifyUnsupportedDigest) { … }
TEST_F(CastAuthUtilTest, VerifyBackwardsCompatibleDigest) { … }
TEST_F(CastAuthUtilTest, VerifyBadPeerCert) { … }
TEST_F(CastAuthUtilTest, VerifySenderNonceMatch) { … }
TEST_F(CastAuthUtilTest, VerifySenderNonceMismatch) { … }
TEST_F(CastAuthUtilTest, VerifySenderNonceMissing) { … }
TEST_F(CastAuthUtilTest, VerifyTLSCertificateSuccess) { … }
TEST_F(CastAuthUtilTest, VerifyTLSCertificateTooEarly) { … }
TEST_F(CastAuthUtilTest, VerifyTLSCertificateTooLate) { … }
enum TestStepResult { … };
ErrorOr<CastDeviceCertPolicy> TestVerifyRevocation(
const std::vector<std::string>& certificate_chain,
const std::string& crl_bundle,
const DateTime& verification_time,
bool crl_required,
TrustStore* cast_trust_store,
TrustStore* crl_trust_store) { … }
bool RunTest(const proto::DeviceCertTest& test_case) { … }
void RunTestSuite(const std::string& test_suite_file_name) { … }
TEST_F(CastAuthUtilTest, CRLTestSuite) { … }
}
}