chromium/third_party/openscreen/src/util/crypto/certificate_utils.cc

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

#include "util/crypto/certificate_utils.h"

#include <openssl/asn1.h>
#include <openssl/bio.h>
#include <openssl/bn.h>
#include <openssl/crypto.h>
#include <openssl/evp.h>
#include <openssl/rsa.h>
#include <openssl/ssl.h>
#include <openssl/x509v3.h>
#include <time.h>

#include <string>

#include "util/crypto/openssl_util.h"
#include "util/crypto/sha2.h"
#include "util/osp_logging.h"

namespace openscreen {

namespace {

// These values are bit positions from RFC 5280 4.2.1.3 and will be passed to
// ASN1_BIT_STRING_set_bit.
enum KeyUsageBits {};

// Returns whether or not the certificate field successfully was added.
bool AddCertificateField(X509_NAME* certificate_name,
                         std::string_view field,
                         std::string_view value) {}

bssl::UniquePtr<ASN1_TIME> ToAsn1Time(std::chrono::seconds time_since_epoch) {}

bssl::UniquePtr<X509> CreateCertificateInternal(
    std::string_view name,
    std::chrono::seconds certificate_duration,
    const EVP_PKEY& key_pair,
    std::chrono::seconds time_since_unix_epoch,
    bool make_ca,
    X509* issuer,
    EVP_PKEY* issuer_key) {}

}  // namespace

bssl::UniquePtr<EVP_PKEY> GenerateRsaKeyPair(int key_bits) {}

ErrorOr<bssl::UniquePtr<X509>> CreateSelfSignedX509Certificate(
    std::string_view name,
    std::chrono::seconds duration,
    const EVP_PKEY& key_pair,
    std::chrono::seconds time_since_unix_epoch,
    bool make_ca,
    X509* issuer,
    EVP_PKEY* issuer_key) {}

ErrorOr<std::vector<uint8_t>> ExportX509CertificateToDer(
    const X509& certificate) {}

ErrorOr<bssl::UniquePtr<X509>> ImportCertificate(const uint8_t* der_x509_cert,
                                                 int der_x509_cert_length) {}

ErrorOr<bssl::UniquePtr<EVP_PKEY>> ImportRSAPrivateKey(
    const uint8_t* der_rsa_private_key,
    int key_length) {}

std::string GetSpkiTlv(X509* cert) {}

ErrorOr<uint64_t> ParseDerUint64(const ASN1_INTEGER* asn1int) {}

}  // namespace openscreen