• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# This file is part of pyasn1-modules software.
3#
4# Created by Russ Housley with 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# RPKI Manifests
10#
11# ASN.1 source from:
12# https://www.rfc-editor.org/rfc/rfc6486.txt
13#
14
15from pyasn1.type import char
16from pyasn1.type import constraint
17from pyasn1.type import namedtype
18from pyasn1.type import tag
19from pyasn1.type import useful
20from pyasn1.type import univ
21
22from pyasn1_modules import rfc5652
23
24MAX = float('inf')
25
26
27id_smime = univ.ObjectIdentifier('1.2.840.113549.1.9.16')
28
29id_ct = id_smime + (1, )
30
31id_ct_rpkiManifest = id_ct + (26, )
32
33
34class FileAndHash(univ.Sequence):
35    componentType = namedtype.NamedTypes(
36        namedtype.NamedType('file', char.IA5String()),
37        namedtype.NamedType('hash', univ.BitString())
38    )
39
40
41class Manifest(univ.Sequence):
42    componentType = namedtype.NamedTypes(
43        namedtype.DefaultedNamedType('version',
44            univ.Integer().subtype(explicitTag=tag.Tag(
45                tag.tagClassContext, tag.tagFormatSimple, 0)).subtype(value=0)),
46        namedtype.NamedType('manifestNumber',
47            univ.Integer().subtype(
48                subtypeSpec=constraint.ValueRangeConstraint(0, MAX))),
49        namedtype.NamedType('thisUpdate',
50            useful.GeneralizedTime()),
51        namedtype.NamedType('nextUpdate',
52            useful.GeneralizedTime()),
53        namedtype.NamedType('fileHashAlg',
54            univ.ObjectIdentifier()),
55        namedtype.NamedType('fileList',
56            univ.SequenceOf(componentType=FileAndHash()).subtype(
57                subtypeSpec=constraint.ValueSizeConstraint(0, MAX)))
58    )
59
60
61# Map of Content Type OIDs to Content Types added to the
62# ones that are in rfc5652.py
63
64_cmsContentTypesMapUpdate = {
65    id_ct_rpkiManifest: Manifest(),
66}
67
68rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
69