Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_CERT_INTERNAL_VERIFY_CERTIFICATE_CHAIN_H_ | |
| 6 #define NET_CERT_INTERNAL_VERIFY_CERTIFICATE_CHAIN_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <string> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "base/basictypes.h" | |
| 14 #include "base/compiler_specific.h" | |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "net/base/net_export.h" | |
| 17 | |
| 18 namespace net { | |
| 19 | |
| 20 namespace der { | |
| 21 class Input; | |
| 22 struct GeneralizedTime; | |
| 23 } | |
| 24 | |
| 25 class SignaturePolicy; | |
| 26 | |
| 27 struct NET_EXPORT TrustedRoot { | |
|
davidben
2015/11/19 22:24:02
Optional: The spec seems to say "trust anchor" eve
eroman
2015/12/03 04:45:12
Done.
| |
| 28 ~TrustedRoot(); | |
| 29 | |
| 30 // DER-encoded SubjectPublicKeyInfo for the trusted key. | |
| 31 std::string spki; | |
| 32 | |
| 33 // DER-encoded "Name" corresponding with this key. | |
| 34 std::string name; | |
| 35 }; | |
| 36 | |
| 37 // A very simple implementation of a TrustStore, which contains mappings from a | |
| 38 // name to a correspoding public key for trusted roots. | |
| 39 struct NET_EXPORT TrustStore { | |
| 40 TrustStore(); | |
| 41 ~TrustStore(); | |
| 42 | |
| 43 std::vector<TrustedRoot> roots; | |
| 44 }; | |
| 45 | |
| 46 // VerifyCertificateChain() verifies a certificate path (chain) based on the | |
| 47 // rules in RFC 5280. | |
| 48 // | |
| 49 // WARNING: This implementation is in progress, and is currently | |
| 50 // incomplete. DO NOT USE IT. You have been warned. | |
| 51 // | |
| 52 // --------- | |
| 53 // Inputs | |
| 54 // --------- | |
| 55 // | |
| 56 // cert_chain: | |
| 57 // A non-empty chain of N DER-encoded certificates, listed in the | |
| 58 // "forward" direction. | |
| 59 // | |
| 60 // * cert_chain[0] is the target certificate to verify. | |
| 61 // * cert_chain[i+1] holds the certificate that issued cert_chain[i]. | |
| 62 // * cert_chain[N-1] must have been issued by a trusted root. | |
| 63 // | |
| 64 // trust_store: | |
| 65 // Contains the set of public keys (and their names) that are trusted as | |
| 66 // roots. | |
| 67 // | |
| 68 // signature_policy: | |
| 69 // The policy to use when verifying signature (what hash algorithms are | |
| 70 // allowed, what length keys, what named curves, etc). | |
| 71 // | |
| 72 // time: | |
| 73 // The UTC time to use for expiration checks. | |
| 74 // | |
| 75 // --------- | |
| 76 // Outputs | |
| 77 // --------- | |
| 78 // | |
| 79 // returns true if the target certificate can be verified and is an | |
| 80 // end-entity certificate. | |
| 81 NET_EXPORT bool VerifyCertificateChain(const std::vector<der::Input>& certs_der, | |
| 82 const TrustStore& trust_store, | |
| 83 const SignaturePolicy* signature_policy, | |
| 84 const der::GeneralizedTime& time) | |
| 85 WARN_UNUSED_RESULT; | |
| 86 | |
| 87 } // namespace net | |
| 88 | |
| 89 #endif // NET_CERT_INTERNAL_VERIFY_CERTIFICATE_CHAIN_H_ | |
| OLD | NEW |