1#!/usr/bin/env python3 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"""Chain where the leaf has two policies and the intermediate has anyPolicy.""" 7 8import sys 9sys.path += ['../../../../net/data'] 10 11import gencerts 12 13# Self-signed root certificate. 14root = gencerts.create_self_signed_root_certificate('Root') 15 16# Intermediate certificate. 17intermediate = gencerts.create_intermediate_certificate('Intermediate', root) 18intermediate.get_extensions().set_property('certificatePolicies', 'anyPolicy') 19 20# Target certificate. 21target = gencerts.create_end_entity_certificate('Target', intermediate) 22target.get_extensions().set_property('certificatePolicies', '1.2.3.4,1.2.6.7') 23target.get_extensions().set_property('subjectAltName', 'DNS:test.example') 24 25chain = [target, intermediate, root] 26gencerts.write_chain(__doc__, chain, 'chain.pem') 27