| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_PATH_BUILDER_H_ | 5 #ifndef NET_CERT_INTERNAL_PATH_BUILDER_H_ |
| 6 #define NET_CERT_INTERNAL_PATH_BUILDER_H_ | 6 #define NET_CERT_INTERNAL_PATH_BUILDER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 ~ResultPath(); | 71 ~ResultPath(); |
| 72 | 72 |
| 73 // Returns true if the candidate path is valid, false otherwise. | 73 // Returns true if the candidate path is valid, false otherwise. |
| 74 bool IsValid() const; | 74 bool IsValid() const; |
| 75 | 75 |
| 76 // The (possibly partial) certificate path. Consumers must always test | 76 // The (possibly partial) certificate path. Consumers must always test |
| 77 // |errors.IsValid()| before using |path|. When invalid, | 77 // |errors.IsValid()| before using |path|. When invalid, |
| 78 // |path.trust_anchor| may be null, and the path may be incomplete. | 78 // |path.trust_anchor| may be null, and the path may be incomplete. |
| 79 CertPath path; | 79 CertPath path; |
| 80 | 80 |
| 81 // The set of policies that the certificate is valid for (of the |
| 82 // subset of policies user requested during verification). |
| 83 std::set<der::Input> user_constrained_policy_set; |
| 84 |
| 81 // The errors/warnings from this path. Use |IsValid()| to determine if the | 85 // The errors/warnings from this path. Use |IsValid()| to determine if the |
| 82 // path is valid. | 86 // path is valid. |
| 83 CertPathErrors errors; | 87 CertPathErrors errors; |
| 84 }; | 88 }; |
| 85 | 89 |
| 86 // Provides the overall result of path building. This includes the paths that | 90 // Provides the overall result of path building. This includes the paths that |
| 87 // were attempted. | 91 // were attempted. |
| 88 struct NET_EXPORT Result { | 92 struct NET_EXPORT Result { |
| 89 Result(); | 93 Result(); |
| 90 ~Result(); | 94 ~Result(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 113 | 117 |
| 114 // TODO(mattm): allow caller specified hook/callback to extend path | 118 // TODO(mattm): allow caller specified hook/callback to extend path |
| 115 // verification. | 119 // verification. |
| 116 // | 120 // |
| 117 // Creates a CertPathBuilder that attempts to find a path from |cert| to a | 121 // Creates a CertPathBuilder that attempts to find a path from |cert| to a |
| 118 // trust anchor in |trust_store|, which satisfies |signature_policy| and is | 122 // trust anchor in |trust_store|, which satisfies |signature_policy| and is |
| 119 // valid at |time|. Details of attempted path(s) are stored in |*result|. | 123 // valid at |time|. Details of attempted path(s) are stored in |*result|. |
| 120 // | 124 // |
| 121 // The caller must keep |trust_store|, |signature_policy|, and |*result| valid | 125 // The caller must keep |trust_store|, |signature_policy|, and |*result| valid |
| 122 // for the lifetime of the CertPathBuilder. | 126 // for the lifetime of the CertPathBuilder. |
| 127 // |
| 128 // See VerifyCertificateChain() for a more detailed explanation of the |
| 129 // same-named parameters. |
| 123 CertPathBuilder(scoped_refptr<ParsedCertificate> cert, | 130 CertPathBuilder(scoped_refptr<ParsedCertificate> cert, |
| 124 TrustStore* trust_store, | 131 TrustStore* trust_store, |
| 125 const SignaturePolicy* signature_policy, | 132 const SignaturePolicy* signature_policy, |
| 126 const der::GeneralizedTime& time, | 133 const der::GeneralizedTime& time, |
| 127 KeyPurpose key_purpose, | 134 KeyPurpose key_purpose, |
| 135 InitialExplicitPolicy initial_explicit_policy, |
| 136 const std::set<der::Input>& user_initial_policy_set, |
| 137 InitialPolicyMappingInhibit initial_policy_mapping_inhibit, |
| 138 InitialAnyPolicyInhibit initial_any_policy_inhibit, |
| 128 Result* result); | 139 Result* result); |
| 129 ~CertPathBuilder(); | 140 ~CertPathBuilder(); |
| 130 | 141 |
| 131 // Adds a CertIssuerSource to provide intermediates for use in path building. | 142 // Adds a CertIssuerSource to provide intermediates for use in path building. |
| 132 // Multiple sources may be added. Must not be called after Run is called. | 143 // Multiple sources may be added. Must not be called after Run is called. |
| 133 // The |*cert_issuer_source| must remain valid for the lifetime of the | 144 // The |*cert_issuer_source| must remain valid for the lifetime of the |
| 134 // CertPathBuilder. | 145 // CertPathBuilder. |
| 135 // | 146 // |
| 136 // (If no issuer sources are added, the target certificate will only verify if | 147 // (If no issuer sources are added, the target certificate will only verify if |
| 137 // it is a trust anchor or is directly signed by a trust anchor.) | 148 // it is a trust anchor or is directly signed by a trust anchor.) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 153 | 164 |
| 154 void DoGetNextPath(); | 165 void DoGetNextPath(); |
| 155 void DoGetNextPathComplete(); | 166 void DoGetNextPathComplete(); |
| 156 | 167 |
| 157 void AddResultPath(std::unique_ptr<ResultPath> result_path); | 168 void AddResultPath(std::unique_ptr<ResultPath> result_path); |
| 158 | 169 |
| 159 std::unique_ptr<CertPathIter> cert_path_iter_; | 170 std::unique_ptr<CertPathIter> cert_path_iter_; |
| 160 const SignaturePolicy* signature_policy_; | 171 const SignaturePolicy* signature_policy_; |
| 161 const der::GeneralizedTime time_; | 172 const der::GeneralizedTime time_; |
| 162 const KeyPurpose key_purpose_; | 173 const KeyPurpose key_purpose_; |
| 174 const InitialExplicitPolicy initial_explicit_policy_; |
| 175 const std::set<der::Input> user_initial_policy_set_; |
| 176 const InitialPolicyMappingInhibit initial_policy_mapping_inhibit_; |
| 177 const InitialAnyPolicyInhibit initial_any_policy_inhibit_; |
| 163 | 178 |
| 164 // Stores the next complete path to attempt verification on. This is filled in | 179 // Stores the next complete path to attempt verification on. This is filled in |
| 165 // by |cert_path_iter_| during the STATE_GET_NEXT_PATH step, and thus should | 180 // by |cert_path_iter_| during the STATE_GET_NEXT_PATH step, and thus should |
| 166 // only be accessed during the STATE_GET_NEXT_PATH_COMPLETE step. | 181 // only be accessed during the STATE_GET_NEXT_PATH_COMPLETE step. |
| 167 // (Will be empty if all paths have been tried, otherwise will be a candidate | 182 // (Will be empty if all paths have been tried, otherwise will be a candidate |
| 168 // path starting with the target cert and ending with a | 183 // path starting with the target cert and ending with a |
| 169 // certificate issued by trust anchor.) | 184 // certificate issued by trust anchor.) |
| 170 CertPath next_path_; | 185 CertPath next_path_; |
| 171 State next_state_; | 186 State next_state_; |
| 172 | 187 |
| 173 Result* out_result_; | 188 Result* out_result_; |
| 174 | 189 |
| 175 DISALLOW_COPY_AND_ASSIGN(CertPathBuilder); | 190 DISALLOW_COPY_AND_ASSIGN(CertPathBuilder); |
| 176 }; | 191 }; |
| 177 | 192 |
| 178 } // namespace net | 193 } // namespace net |
| 179 | 194 |
| 180 #endif // NET_CERT_INTERNAL_PATH_BUILDER_H_ | 195 #endif // NET_CERT_INTERNAL_PATH_BUILDER_H_ |
| OLD | NEW |