• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# This file is part of pyasn1-modules software.
3#
4# Created by Russ Housley with some assistance from asn1ate v.0.6.0.
5#
6# Copyright (c) 2019, Vigil Security, LLC
7# License: http://snmplabs.com/pyasn1/license.html
8#
9# Authentication Context Certificate Extension
10#
11# ASN.1 source from:
12# https://www.rfc-editor.org/rfc/rfc7773.txt
13#
14
15from pyasn1.type import char
16from pyasn1.type import constraint
17from pyasn1.type import namedtype
18from pyasn1.type import univ
19
20from pyasn1_modules import rfc5280
21
22MAX = float('inf')
23
24
25# Authentication Context Extension
26
27e_legnamnden = univ.ObjectIdentifier('1.2.752.201')
28
29id_eleg_ce = e_legnamnden + (5, )
30
31id_ce_authContext = id_eleg_ce + (1, )
32
33
34class AuthenticationContext(univ.Sequence):
35    componentType = namedtype.NamedTypes(
36        namedtype.NamedType('contextType', char.UTF8String()),
37        namedtype.OptionalNamedType('contextInfo', char.UTF8String())
38    )
39
40class AuthenticationContexts(univ.SequenceOf):
41    componentType = AuthenticationContext()
42    subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
43
44
45# Map of Certificate Extension OIDs to Extensions added to the
46# ones that are in rfc5280.py
47
48_certificateExtensionsMapUpdate = {
49    id_ce_authContext: AuthenticationContexts(),
50}
51
52rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
53