etingof / pyasn1-modules

ASN.1 modules for pyasn1 library
http://snmplabs.com/pyasn1/
BSD 2-Clause "Simplified" License
41 stars 45 forks source link

rfc4055 missing *WithRSAEncryption Algorithm Identifiers #137

Open gareththered opened 4 years ago

gareththered commented 4 years ago

The rfc4055 module has identifiers for raw sha224 to sha512, but none for the withRSAEncryption variants.

It has the following, which is discussed in the 5th paragraph of RFC 4055 Section 5:

sha256Identifier = rfc5280.AlgorithmIdentifier()
sha256Identifier['algorithm'] = id_sha256
sha256Identifier['parameters'] = univ.Null("")

But it doesn't have, the following which is discussed in the subsequent paragraphs of Section 5 of the RFC:

sha256WithRSAEncryptionIdentifier = rfc5280.AlgorithmIdentifier()
sha256WithRSAEncryptionIdentifier['algorithm'] = sha256WithRSAEncryption
sha256WithRSAEncryptionIdentifier['parameters'] = univ.Null("")

The same goes for sha224, sha384 and sha512.

russhousley commented 3 years ago

Only the OIDs are included in the ASN.1 module in Section 6, which was used to make this module.

The sha224, sha384, and sha256 identifiers are in the module:

sha1Identifier = rfc5280.AlgorithmIdentifier()
sha1Identifier['algorithm'] = id_sha1
sha1Identifier['parameters'] = univ.Null("")

sha224Identifier = rfc5280.AlgorithmIdentifier()
sha224Identifier['algorithm'] = id_sha224
sha224Identifier['parameters'] = univ.Null("")

sha256Identifier = rfc5280.AlgorithmIdentifier()
sha256Identifier['algorithm'] = id_sha256
sha256Identifier['parameters'] = univ.Null("")

sha384Identifier = rfc5280.AlgorithmIdentifier()
sha384Identifier['algorithm'] = id_sha384
sha384Identifier['parameters'] = univ.Null("")

sha512Identifier = rfc5280.AlgorithmIdentifier()
sha512Identifier['algorithm'] = id_sha512
sha512Identifier['parameters'] = univ.Null("")
russhousley commented 3 years ago

It seem that this repository is not being maintained any more. I have made recent additions to https://github.com/inexio/pyasn1-modules.

For your convenience, I will add these in that repository:

sha224WithRSAEncryptionIdentifier = rfc5280.AlgorithmIdentifier()
sha224WithRSAEncryptionIdentifier['algorithm'] = sha224WithRSAEncryption
sha224WithRSAEncryptionIdentifier['parameters'] = univ.Null("")

sha256WithRSAEncryptionIdentifier = rfc5280.AlgorithmIdentifier()
sha256WithRSAEncryptionIdentifier['algorithm'] = sha256WithRSAEncryption
sha256WithRSAEncryptionIdentifier['parameters'] = univ.Null("")

sha384WithRSAEncryptionIdentifier = rfc5280.AlgorithmIdentifier()
sha384WithRSAEncryptionIdentifier['algorithm'] = sha384WithRSAEncryption
sha384WithRSAEncryptionIdentifier['parameters'] = univ.Null("")

sha512WithRSAEncryptionIdentifier = rfc5280.AlgorithmIdentifier()
sha512WithRSAEncryptionIdentifier['algorithm'] = sha512WithRSAEncryption
sha512WithRSAEncryptionIdentifier['parameters'] = univ.Null("")