1#!/usr/bin/env python 2# Copyright 2022 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"""Certificate chain where the target certificate sets the extended key usage 6to clientAuth. Neither the root nor the intermediate have an EKU.""" 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. 17intermediate = gencerts.create_intermediate_certificate('Intermediate', root) 18 19# Target certificate. 20target = gencerts.create_end_entity_certificate('Target', intermediate) 21target.get_extensions().set_property('extendedKeyUsage', 'anyExtendedKeyUsage') 22 23chain = [target, intermediate, root] 24gencerts.write_chain(__doc__, chain, 'chain.pem') 25