chromium/third_party/openscreen/src/cast/common/certificate/cast_crl.h

// 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.

#ifndef CAST_COMMON_CERTIFICATE_CAST_CRL_H_
#define CAST_COMMON_CERTIFICATE_CAST_CRL_H_

#include <memory>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include "cast/common/certificate/cast_cert_validator.h"
#include "cast/common/certificate/proto/revocation.pb.h"
#include "platform/base/macros.h"

namespace openscreen::cast {

class ParsedCertificate;
class TrustStore;

// This class represents the certificate revocation list information parsed from
// the binary in a protobuf message.
class CastCRL {};

// Parses and verifies the CRL used to verify the revocation status of
// Cast device certificates, using the built-in Cast CRL trust anchors.
//
// Inputs:
// * |crl_proto| is a serialized cast_certificate.CrlBundle proto.
// * |time| is the timestamp to use for determining if the CRL is valid.
// * |trust_store| is the set of trust anchors to use.
//
// Output:
// Returns the CRL object if success, nullptr otherwise.
std::unique_ptr<CastCRL> ParseAndVerifyCRL(const std::string& crl_proto,
                                           const DateTime& time,
                                           TrustStore* trust_store);

}  // namespace openscreen::cast

#endif  // CAST_COMMON_CERTIFICATE_CAST_CRL_H_