rfc5915.py 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. # This file is being contributed to pyasn1-modules software.
  2. #
  3. # Created by Russ Housley with assistance from asn1ate v.0.6.0.
  4. #
  5. # Copyright (c) 2019, Vigil Security, LLC
  6. # License: http://snmplabs.com/pyasn1/license.html
  7. #
  8. # Elliptic Curve Private Key
  9. #
  10. # ASN.1 source from:
  11. # https://www.rfc-editor.org/rfc/rfc5915.txt
  12. from pyasn1.type import namedtype
  13. from pyasn1.type import namedval
  14. from pyasn1.type import tag
  15. from pyasn1.type import univ
  16. from pyasn1_modules import rfc5480
  17. class ECPrivateKey(univ.Sequence):
  18. pass
  19. ECPrivateKey.componentType = namedtype.NamedTypes(
  20. namedtype.NamedType('version', univ.Integer(
  21. namedValues=namedval.NamedValues(('ecPrivkeyVer1', 1)))),
  22. namedtype.NamedType('privateKey', univ.OctetString()),
  23. namedtype.OptionalNamedType('parameters', rfc5480.ECParameters().subtype(
  24. explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
  25. namedtype.OptionalNamedType('publicKey', univ.BitString().subtype(
  26. explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
  27. )