| Index: components/cast_certificate/cast_crl.h
|
| diff --git a/components/cast_certificate/cast_crl.h b/components/cast_certificate/cast_crl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..769d0579769e5e1c8d92a017cf307c0cec6ff0e1
|
| --- /dev/null
|
| +++ b/components/cast_certificate/cast_crl.h
|
| @@ -0,0 +1,65 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef COMPONENTS_CAST_CERTIFICATE_CAST_CRL_H_
|
| +#define COMPONENTS_CAST_CERTIFICATE_CAST_CRL_H_
|
| +
|
| +#include <memory>
|
| +#include <string>
|
| +#include <unordered_map>
|
| +#include <unordered_set>
|
| +#include <vector>
|
| +
|
| +#include "base/compiler_specific.h"
|
| +#include "base/time/time.h"
|
| +
|
| +namespace cast_certificate {
|
| +
|
| +// This class represents the CRL information parsed from the binary proto.
|
| +class CastCRL {
|
| + public:
|
| + virtual ~CastCRL(){};
|
| +
|
| + // Verifies the revocation status of a cast device certificate given a chain
|
| + // of DER-encoded certificates.
|
| + //
|
| + // Inputs:
|
| + // * |certs| is a chain of DER-encoded certificates:
|
| + // * |certs[0]| is the target certificate (i.e. the device certificate)
|
| + // * |certs[i]| is the certificate that issued certs[i-1]
|
| + // * |certs.back()| must be signed by a trust anchor
|
| + //
|
| + // * |time| is the UTC time to use for determining if the certificate
|
| + // is revoked.
|
| + virtual bool VerifyDeviceCertRevocation(const std::vector<std::string>& certs,
|
| + const base::Time::Exploded& time) = 0;
|
| +};
|
| +
|
| +// Parse and verify the CRL used to verify the revocation status of
|
| +// Cast device certificates.
|
| +//
|
| +// Inputs:
|
| +// * |crl_proto| is the byte representation of the Cast CRL proto
|
| +// Output:
|
| +// Returns the CRL object if success, nullptr otherwise.
|
| +std::unique_ptr<CastCRL> ParseCRL(const std::string& crl_proto);
|
| +
|
| +// Exposed only for testing, not for use in production code.
|
| +//
|
| +// Injects trusted root certificates into the CastCRLTrustStore.
|
| +// |data| must remain valid and not be mutated throughout the lifetime of
|
| +// the program.
|
| +// Warning: Using this function concurrently with VerifyDeviceCert()
|
| +// is not thread safe.
|
| +bool AddCRLTrustAnchorForTest(const uint8_t* data,
|
| + size_t length) WARN_UNUSED_RESULT;
|
| +
|
| +// Exposed only for testing, not for use in production code.
|
| +//
|
| +// Clears trusted root certificates from CastCRLTrustStore
|
| +void ClearCRLTrustAnchorForTest();
|
| +
|
| +} // namespace cast_certificate
|
| +
|
| +#endif // COMPONENTS_CAST_CERTIFICATE_CAST_CRL_H_
|
|
|