michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: scenario TrustAnchors michael@0: michael@0: entity RootCA michael@0: type Root michael@0: michael@0: entity CA1 michael@0: type Intermediate michael@0: issuer RootCA michael@0: michael@0: entity CA2 michael@0: type Intermediate michael@0: issuer CA1 michael@0: michael@0: entity EE1 michael@0: type EE michael@0: issuer CA2 michael@0: michael@0: entity OtherRoot michael@0: type Root michael@0: michael@0: entity OtherIntermediate michael@0: type Intermediate michael@0: issuer OtherRoot michael@0: michael@0: entity EE2 michael@0: type EE michael@0: issuer OtherIntermediate michael@0: michael@0: # Scenarios where trust only comes from the DB michael@0: db DBOnly michael@0: michael@0: import RootCA::CT,C,C michael@0: import CA1:RootCA: michael@0: michael@0: # Simple chaining - no trust anchors michael@0: verify EE1:CA2 michael@0: cert CA2:CA1 michael@0: result pass michael@0: michael@0: # Simple trust anchors - ignore the Cert DB michael@0: verify EE1:CA2 michael@0: trust CA2:CA1 michael@0: result pass michael@0: michael@0: # Redundant trust - trust anchor and DB michael@0: verify EE1:CA2 michael@0: cert CA2:CA1 michael@0: trust RootCA michael@0: result pass michael@0: michael@0: michael@0: # Scenarios where trust only comes from trust anchors michael@0: db TrustOnly michael@0: michael@0: # Simple checking - direct trust anchor michael@0: verify EE1:CA2 michael@0: cert CA2:CA1 michael@0: cert CA1:RootCA: michael@0: trust RootCA: michael@0: result pass michael@0: michael@0: # Partial chain (not self-signed), with a trust anchor michael@0: verify EE1:CA2 michael@0: trust CA2:CA1 michael@0: result pass michael@0: michael@0: michael@0: # Scenarios where trust comes from both trust anchors and the DB michael@0: db TrustAndDB michael@0: michael@0: import RootCA::CT,C,C michael@0: import CA1:RootCA: michael@0: michael@0: # Check that trust in the DB works michael@0: verify EE1:CA2 michael@0: cert CA2:CA1 michael@0: result pass michael@0: michael@0: # Check that trust anchors work michael@0: verify EE2:OtherIntermediate michael@0: cert OtherIntermediate:OtherRoot michael@0: trust OtherRoot: michael@0: result pass michael@0: michael@0: # Check that specifying a trust anchor still allows searching the cert DB michael@0: verify EE1:CA2 michael@0: trust_and_db michael@0: cert CA2:CA1 michael@0: trust OtherIntermediate:OtherRoot michael@0: trust OtherRoot: michael@0: result pass michael@0: michael@0: # Scenarios where the trust DB has explicitly distrusted one or more certs, michael@0: # even when the trust anchors indicate trust michael@0: db ExplicitDistrust michael@0: michael@0: import RootCA::CT,C,C michael@0: import CA1:RootCA:p,p,p michael@0: import OtherRoot::p,p,p michael@0: michael@0: # Verify that a distrusted intermediate, but trusted root, is rejected. michael@0: verify EE1:CA2 michael@0: cert CA2:CA1 michael@0: trust CA1:RootCA michael@0: result fail michael@0: michael@0: # Verify that a trusted intermediate, but distrusted root, is accepted. michael@0: verify EE2:OtherIntermediate michael@0: trust OtherIntermediate:OtherRoot michael@0: result pass