rfc2314.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #
  2. # PKCS#10 syntax
  3. #
  4. # ASN.1 source from:
  5. # http://tools.ietf.org/html/rfc2314
  6. #
  7. # Sample captures could be obtained with "openssl req" command
  8. #
  9. from pyasn1.type import tag, namedtype, namedval, univ, constraint
  10. from pyasn1_modules.rfc2459 import *
  11. class Attributes(univ.SetOf):
  12. componentType = Attribute()
  13. class Version(univ.Integer): pass
  14. class CertificationRequestInfo(univ.Sequence):
  15. componentType = namedtype.NamedTypes(
  16. namedtype.NamedType('version', Version()),
  17. namedtype.NamedType('subject', Name()),
  18. namedtype.NamedType('subjectPublicKeyInfo', SubjectPublicKeyInfo()),
  19. namedtype.NamedType('attributes', Attributes().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
  20. )
  21. class Signature(univ.BitString): pass
  22. class SignatureAlgorithmIdentifier(AlgorithmIdentifier): pass
  23. class CertificationRequest(univ.Sequence):
  24. componentType = namedtype.NamedTypes(
  25. namedtype.NamedType('certificationRequestInfo', CertificationRequestInfo()),
  26. namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()),
  27. namedtype.NamedType('signature', Signature())
  28. )