You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rfc6019.py 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. from pyasn1.type import constraint
  14. from pyasn1.type import univ
  15. from pyasn1_modules import rfc5652
  16. MAX = float('inf')
  17. # BinaryTime: Represent date and time as an integer
  18. class BinaryTime(univ.Integer):
  19. pass
  20. BinaryTime.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
  21. # CMS Attribute for representing signing time in BinaryTime
  22. id_aa_binarySigningTime = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.46')
  23. class BinarySigningTime(BinaryTime):
  24. pass
  25. # Map of Attribute Type OIDs to Attributes ia added to the
  26. # ones that are in rfc5652.py
  27. _cmsAttributesMapUpdate = {
  28. id_aa_binarySigningTime: BinarySigningTime(),
  29. }
  30. rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)