#include "cast/receiver/channel/static_credentials.h"
#include <openssl/mem.h>
#include <openssl/pem.h>
#include <cstdio>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "platform/base/tls_credentials.h"
#include "util/crypto/certificate_utils.h"
#include "util/osp_logging.h"
namespace openscreen::cast {
namespace {
FileUniquePtr;
constexpr char kGeneratedRootCertificateName[] = …;
constexpr char kGeneratedPrivateKey[] = …;
constexpr int kThreeDaysInSeconds = …;
constexpr auto kCertificateDuration = …;
ErrorOr<GeneratedCredentials> GenerateCredentials(
std::string device_certificate_id,
EVP_PKEY* root_key,
X509* root_cert) { … }
bssl::UniquePtr<EVP_PKEY> GeneratePrivateKey() { … }
bssl::UniquePtr<X509> GenerateRootCert(const EVP_PKEY& root_key) { … }
}
StaticCredentialsProvider::StaticCredentialsProvider() = default;
StaticCredentialsProvider::StaticCredentialsProvider(
DeviceCredentials device_creds,
std::vector<uint8_t> tls_cert_der)
: … { … }
StaticCredentialsProvider::StaticCredentialsProvider(
StaticCredentialsProvider&&) noexcept = default;
StaticCredentialsProvider& StaticCredentialsProvider::operator=(
StaticCredentialsProvider&&) = default;
StaticCredentialsProvider::~StaticCredentialsProvider() = default;
void GenerateDeveloperCredentialsToFile() { … }
ErrorOr<GeneratedCredentials> GenerateCredentialsForTesting(
const std::string& device_certificate_id) { … }
ErrorOr<GeneratedCredentials> GenerateCredentials(
const std::string& device_certificate_id,
const std::string& private_key_path,
const std::string& server_certificate_path) { … }
}