rfc2631.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. # Diffie-Hellman Key Agreement
  10. #
  11. # ASN.1 source from:
  12. # https://www.rfc-editor.org/rfc/rfc2631.txt
  13. # https://www.rfc-editor.org/errata/eid5897
  14. #
  15. from pyasn1.type import constraint
  16. from pyasn1.type import namedtype
  17. from pyasn1.type import tag
  18. from pyasn1.type import univ
  19. class KeySpecificInfo(univ.Sequence):
  20. componentType = namedtype.NamedTypes(
  21. namedtype.NamedType('algorithm', univ.ObjectIdentifier()),
  22. namedtype.NamedType('counter', univ.OctetString().subtype(
  23. subtypeSpec=constraint.ValueSizeConstraint(4, 4)))
  24. )
  25. class OtherInfo(univ.Sequence):
  26. componentType = namedtype.NamedTypes(
  27. namedtype.NamedType('keyInfo', KeySpecificInfo()),
  28. namedtype.OptionalNamedType('partyAInfo', univ.OctetString().subtype(
  29. explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
  30. namedtype.NamedType('suppPubInfo', univ.OctetString().subtype(
  31. explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
  32. )