• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This file is being contributed to pyasn1-modules software.
2#
3# Created by Russ Housley.
4# Modified by Russ Housley to add a map for use with opentypes.
5#
6# Copyright (c) 2019, Vigil Security, LLC
7# License: http://snmplabs.com/pyasn1/license.html
8#
9# BinaryTime: An Alternate Format for Representing Date and Time
10#
11# ASN.1 source from:
12# https://www.rfc-editor.org/rfc/rfc6019.txt
13
14from pyasn1.type import constraint
15from pyasn1.type import univ
16
17from pyasn1_modules import rfc5652
18
19MAX = float('inf')
20
21
22# BinaryTime: Represent date and time as an integer
23
24class BinaryTime(univ.Integer):
25    pass
26
27BinaryTime.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
28
29
30# CMS Attribute for representing signing time in BinaryTime
31
32id_aa_binarySigningTime = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.46')
33
34class BinarySigningTime(BinaryTime):
35    pass
36
37
38# Map of Attribute Type OIDs to Attributes ia added to the
39# ones that are in rfc5652.py
40
41_cmsAttributesMapUpdate = {
42    id_aa_binarySigningTime: BinarySigningTime(),
43}
44
45rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
46