Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
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.

rfc5208.py 1.4KB

1 year ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #
  2. # This file is part of pyasn1-modules software.
  3. #
  4. # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
  5. # License: http://snmplabs.com/pyasn1/license.html
  6. #
  7. # PKCS#8 syntax
  8. #
  9. # ASN.1 source from:
  10. # http://tools.ietf.org/html/rfc5208
  11. #
  12. # Sample captures could be obtained with "openssl pkcs8 -topk8" command
  13. #
  14. from pyasn1_modules import rfc2251
  15. from pyasn1_modules.rfc2459 import *
  16. class KeyEncryptionAlgorithms(AlgorithmIdentifier):
  17. pass
  18. class PrivateKeyAlgorithms(AlgorithmIdentifier):
  19. pass
  20. class EncryptedData(univ.OctetString):
  21. pass
  22. class EncryptedPrivateKeyInfo(univ.Sequence):
  23. componentType = namedtype.NamedTypes(
  24. namedtype.NamedType('encryptionAlgorithm', AlgorithmIdentifier()),
  25. namedtype.NamedType('encryptedData', EncryptedData())
  26. )
  27. class PrivateKey(univ.OctetString):
  28. pass
  29. class Attributes(univ.SetOf):
  30. componentType = rfc2251.Attribute()
  31. class Version(univ.Integer):
  32. namedValues = namedval.NamedValues(('v1', 0), ('v2', 1))
  33. class PrivateKeyInfo(univ.Sequence):
  34. componentType = namedtype.NamedTypes(
  35. namedtype.NamedType('version', Version()),
  36. namedtype.NamedType('privateKeyAlgorithm', AlgorithmIdentifier()),
  37. namedtype.NamedType('privateKey', PrivateKey()),
  38. namedtype.OptionalNamedType('attributes', Attributes().subtype(
  39. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
  40. )