| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_CERT_INTERNAL_VERIFY_CERTIFICATE_CHAIN_H_ | 5 #ifndef NET_CERT_INTERNAL_VERIFY_CERTIFICATE_CHAIN_H_ |
| 6 #define NET_CERT_INTERNAL_VERIFY_CERTIFICATE_CHAIN_H_ | 6 #define NET_CERT_INTERNAL_VERIFY_CERTIFICATE_CHAIN_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
| 13 #include "net/cert/internal/parsed_certificate.h" | 13 #include "net/cert/internal/parsed_certificate.h" |
| 14 #include "net/der/input.h" | 14 #include "net/der/input.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 namespace der { | 18 namespace der { |
| 19 struct GeneralizedTime; | 19 struct GeneralizedTime; |
| 20 } | 20 } |
| 21 | 21 |
| 22 class SignaturePolicy; | 22 class SignaturePolicy; |
| 23 class TrustAnchor; |
| 23 class TrustStore; | 24 class TrustStore; |
| 24 | 25 |
| 25 // VerifyCertificateChainAssumingTrustedRoot() verifies a certificate path | 26 // VerifyCertificateChain() verifies a certificate path (chain) based on the |
| 26 // (chain) based on the rules in RFC 5280. The caller is responsible for | 27 // rules in RFC 5280. The caller is responsible for building the path and |
| 27 // building the path and ensuring the chain ends in a trusted root certificate. | 28 // finding the trust anchor. |
| 28 // | 29 // |
| 29 // WARNING: This implementation is in progress, and is currently incomplete. | 30 // WARNING: This implementation is in progress, and is currently incomplete. |
| 30 // Consult an OWNER before using it. | 31 // Consult an OWNER before using it. |
| 31 // | 32 // |
| 33 // TODO(eroman): Take a CertPath instead of ParsedCertificateList + |
| 34 // TrustAnchor. |
| 35 // |
| 32 // --------- | 36 // --------- |
| 33 // Inputs | 37 // Inputs |
| 34 // --------- | 38 // --------- |
| 35 // | 39 // |
| 36 // cert_chain: | 40 // cert_chain: |
| 37 // A non-empty chain of N DER-encoded certificates, listed in the | 41 // A non-empty chain of N DER-encoded certificates, listed in the |
| 38 // "forward" direction. | 42 // "forward" direction. |
| 39 // | 43 // |
| 40 // * cert_chain[0] is the target certificate to verify. | 44 // * cert_chain[0] is the target certificate to verify. |
| 41 // * cert_chain[i+1] holds the certificate that issued cert_chain[i]. | 45 // * cert_chain[i+1] holds the certificate that issued cert_chain[i]. |
| 42 // * cert_chain[N-1] must be the trust anchor. | 46 // * cert_chain[N-1] must be issued by the trust anchor. |
| 43 // | 47 // |
| 44 // trust_store: | 48 // trust_anchor: |
| 45 // Contains the set of trusted public keys (and their names). This is only | 49 // Contains the trust anchor (root) used to verify the chain. |
| 46 // used to DCHECK that the final cert is a trust anchor. | |
| 47 // | 50 // |
| 48 // signature_policy: | 51 // signature_policy: |
| 49 // The policy to use when verifying signatures (what hash algorithms are | 52 // The policy to use when verifying signatures (what hash algorithms are |
| 50 // allowed, what length keys, what named curves, etc). | 53 // allowed, what length keys, what named curves, etc). |
| 51 // | 54 // |
| 52 // time: | 55 // time: |
| 53 // The UTC time to use for expiration checks. | 56 // The UTC time to use for expiration checks. |
| 54 // | 57 // |
| 55 // --------- | 58 // --------- |
| 56 // Outputs | 59 // Outputs |
| 57 // --------- | 60 // --------- |
| 58 // | 61 // |
| 59 // Returns true if the target certificate can be verified. | 62 // Returns true if the target certificate can be verified. |
| 60 NET_EXPORT bool VerifyCertificateChainAssumingTrustedRoot( | 63 NET_EXPORT bool VerifyCertificateChain(const ParsedCertificateList& certs, |
| 61 const ParsedCertificateList& certs, | 64 const TrustAnchor* trust_anchor, |
| 62 // The trust store is only used for assertions. | 65 const SignaturePolicy* signature_policy, |
| 63 const TrustStore& trust_store, | 66 const der::GeneralizedTime& time) |
| 64 const SignaturePolicy* signature_policy, | 67 WARN_UNUSED_RESULT; |
| 65 const der::GeneralizedTime& time) WARN_UNUSED_RESULT; | |
| 66 | 68 |
| 67 } // namespace net | 69 } // namespace net |
| 68 | 70 |
| 69 #endif // NET_CERT_INTERNAL_VERIFY_CERTIFICATE_CHAIN_H_ | 71 #endif // NET_CERT_INTERNAL_VERIFY_CERTIFICATE_CHAIN_H_ |
| OLD | NEW |