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.

rfc3447.py 1.6KB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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#1 syntax
  8. #
  9. # ASN.1 source from:
  10. # ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1.asn
  11. #
  12. # Sample captures could be obtained with "openssl genrsa" command
  13. #
  14. from pyasn1.type import constraint
  15. from pyasn1.type import namedval
  16. from pyasn1_modules.rfc2437 import *
  17. class OtherPrimeInfo(univ.Sequence):
  18. componentType = namedtype.NamedTypes(
  19. namedtype.NamedType('prime', univ.Integer()),
  20. namedtype.NamedType('exponent', univ.Integer()),
  21. namedtype.NamedType('coefficient', univ.Integer())
  22. )
  23. class OtherPrimeInfos(univ.SequenceOf):
  24. componentType = OtherPrimeInfo()
  25. sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
  26. class RSAPrivateKey(univ.Sequence):
  27. componentType = namedtype.NamedTypes(
  28. namedtype.NamedType('version', univ.Integer(namedValues=namedval.NamedValues(('two-prime', 0), ('multi', 1)))),
  29. namedtype.NamedType('modulus', univ.Integer()),
  30. namedtype.NamedType('publicExponent', univ.Integer()),
  31. namedtype.NamedType('privateExponent', univ.Integer()),
  32. namedtype.NamedType('prime1', univ.Integer()),
  33. namedtype.NamedType('prime2', univ.Integer()),
  34. namedtype.NamedType('exponent1', univ.Integer()),
  35. namedtype.NamedType('exponent2', univ.Integer()),
  36. namedtype.NamedType('coefficient', univ.Integer()),
  37. namedtype.OptionalNamedType('otherPrimeInfos', OtherPrimeInfos())
  38. )