• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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"""Certificate chain where the target certificate contains an unknown X.509v3
7extension (OID=1.2.3.4) that is marked as critical."""
8
9import sys
10sys.path += ['../..']
11
12import gencerts
13
14# Self-signed root certificate.
15root = gencerts.create_self_signed_root_certificate('Root')
16
17# Intermediate certificate.
18intermediate = gencerts.create_intermediate_certificate('Intermediate', root)
19
20# Target certificate (has unknown critical extension).
21target = gencerts.create_end_entity_certificate('Target', intermediate)
22target.get_extensions().add_property('1.2.3.4',
23                                     'critical,DER:01:02:03:04')
24
25chain = [target, intermediate, root]
26gencerts.write_chain(__doc__, chain, 'chain.pem')
27
28gencerts.write_chain(__doc__, [target], 'target_only.pem')
29