OLD | NEW |
(Empty) | |
| 1 # |
| 2 # PKCS#1 syntax |
| 3 # |
| 4 # ASN.1 source from: |
| 5 # ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2.asn |
| 6 # |
| 7 # Sample captures could be obtained with "openssl genrsa" command |
| 8 # |
| 9 from pyasn1.type import tag, namedtype, namedval, univ, constraint |
| 10 from pyasn1_modules.rfc2459 import AlgorithmIdentifier |
| 11 |
| 12 pkcs_1 = univ.ObjectIdentifier('1.2.840.113549.1.1') |
| 13 rsaEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.1') |
| 14 md2WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.2') |
| 15 md4WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.3') |
| 16 md5WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.4') |
| 17 sha1WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.5') |
| 18 rsaOAEPEncryptionSET = univ.ObjectIdentifier('1.2.840.113549.1.1.6') |
| 19 id_RSAES_OAEP = univ.ObjectIdentifier('1.2.840.113549.1.1.7') |
| 20 id_mgf1 = univ.ObjectIdentifier('1.2.840.113549.1.1.8') |
| 21 id_pSpecified = univ.ObjectIdentifier('1.2.840.113549.1.1.9') |
| 22 id_sha1 = univ.ObjectIdentifier('1.3.14.3.2.26') |
| 23 |
| 24 MAX = 16 |
| 25 |
| 26 class Version(univ.Integer): pass |
| 27 |
| 28 class RSAPrivateKey(univ.Sequence): |
| 29 componentType = namedtype.NamedTypes( |
| 30 namedtype.NamedType('version', Version()), |
| 31 namedtype.NamedType('modulus', univ.Integer()), |
| 32 namedtype.NamedType('publicExponent', univ.Integer()), |
| 33 namedtype.NamedType('privateExponent', univ.Integer()), |
| 34 namedtype.NamedType('prime1', univ.Integer()), |
| 35 namedtype.NamedType('prime2', univ.Integer()), |
| 36 namedtype.NamedType('exponent1', univ.Integer()), |
| 37 namedtype.NamedType('exponent2', univ.Integer()), |
| 38 namedtype.NamedType('coefficient', univ.Integer()) |
| 39 ) |
| 40 |
| 41 class RSAPublicKey(univ.Sequence): |
| 42 componentType = namedtype.NamedTypes( |
| 43 namedtype.NamedType('modulus', univ.Integer()), |
| 44 namedtype.NamedType('publicExponent', univ.Integer()) |
| 45 ) |
| 46 |
| 47 # XXX defaults not set |
| 48 class RSAES_OAEP_params(univ.Sequence): |
| 49 componentType = namedtype.NamedTypes( |
| 50 namedtype.NamedType('hashFunc', AlgorithmIdentifier().subtype(implicitTa
g=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))), |
| 51 namedtype.NamedType('maskGenFunc', AlgorithmIdentifier().subtype(implici
tTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))), |
| 52 namedtype.NamedType('pSourceFunc', AlgorithmIdentifier().subtype(implici
tTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))) |
| 53 ) |
OLD | NEW |