• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(
22    'extendedKeyUsage',
23    'clientAuth,serverAuth,codeSigning,OCSPSigning,timeStamping')
24chain = [target, intermediate, root]
25gencerts.write_chain(__doc__, chain, 'chain.pem')
26