• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# Copyright 2023 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 contains an
6MSApplicationPolicies extension that is marked as critical and
7also contains an extendedKeyUsage extension."""
8
9import sys
10
11sys.path += ['../..']
12
13import gencerts
14
15# Self-signed root certificate.
16root = gencerts.create_self_signed_root_certificate('Root')
17
18# Intermediate certificate.
19intermediate = gencerts.create_intermediate_certificate('Intermediate', root)
20
21# Target certificate (has unknown critical extension).
22target = gencerts.create_end_entity_certificate('Target', intermediate)
23target.get_extensions().add_property('1.3.6.1.4.1.311.21.10',
24                                     'critical,DER:01:02:03:04')
25target.get_extensions().set_property('extendedKeyUsage', 'serverAuth')
26
27chain = [target, intermediate, root]
28gencerts.write_chain(__doc__, chain, 'chain.pem')
29