chromium/net/tools/transport_security_state_generator/cert_util_unittest.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include <string>
#include <vector>

#include "net/tools/transport_security_state_generator/cert_util.h"
#include "net/tools/transport_security_state_generator/spki_hash.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/boringssl/src/include/openssl/x509v3.h"

namespace net::transport_security_state {

namespace {

// Certficate with the subject CN set to "Chromium", the subject organisation
// set to "The Chromium Projects", and the subject organizational unit set to
// "Security."
static const char kSelfSignedWithCommonNamePEM[] =;

// Certificate without a subject CN. The subject organisation is set to
// "The Chromium Projects" and the subject origanisational unit is set to
// "Security".
static const char kSelfSignedWithoutCommonNamePEM[] =;

// Certificate without a subject CN, organisation or organizational unit.
static const char kSelfSignedWithoutSubject[] =;

// Valid PEM certificate headers but invalid BASE64 content.
static const char kInvalidCertificatePEM[] =;

// Valid PEM public key headers but invalid BASE64 content.
static const char kInvalidPublicKeyPEM[] =;

// Valid 2048 bit RSA public key.
static const char kPublicKeyPEM[] =;

// Valid 2048 bit RSA public key with incorrect PEM headers.
static const char kUnknownPEMHeaders[] =;

TEST(CertUtilTest, GetX509CertificateFromPEM) {}

// Test that the SPKI digest is correctly calculated for valid certificates.
TEST(CertUtilTest, CalculateSPKIHashFromCertificate) {}

// Test that the SPKI digest for public key's are calculated correctly.
TEST(CertUtilTest, CalculateSPKIHashFromKey) {}

// Test that the subject name is extracted correctly. This should default to the
// subject common name and fall back to the organisation + organizational unit.
TEST(CertUtilTest, ExtractSubjectNameFromCertificate) {}

}  // namespace

}  // namespace net::transport_security_state