1#!/usr/bin/env python 2# Copyright 2015 The Chromium Authors 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6"""Certificate chain where the target certificate has an incorrect signature.""" 7 8import sys 9sys.path += ['../..'] 10 11import gencerts 12 13# Self-signed root certificate. 14root = gencerts.create_self_signed_root_certificate('Root') 15 16# Intermediate certificate to include in the certificate chain. 17intermediate = gencerts.create_intermediate_certificate('Intermediate', root) 18 19# Actual intermediate that was used to sign the target certificate. It has the 20# same subject as expected, but a different RSA key from the certificate 21# included in the actual chain. 22wrong_intermediate = gencerts.create_intermediate_certificate('Intermediate', 23 root) 24 25# Target certificate, signed using |wrong_intermediate| NOT |intermediate|. 26target = gencerts.create_end_entity_certificate('Target', wrong_intermediate) 27 28chain = [target, intermediate, root] 29gencerts.write_chain(__doc__, chain, 'chain.pem') 30