Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not possible create CMS with rsaEncryption as signature algorithm #468

Open
harrison314 opened this issue Jun 16, 2023 · 0 comments
Open

Comments

@harrison314
Copy link
Contributor

When creating the time stamp, I encountered the problem that it was not possible to issue a time stamp in which the signature algorithm was specified (in CMS terminology - encryption algorithm) rsaEncryption (1.2.840.113549.1.1.1) when I wanted to use ISignatureFactory (ISignatureFactory.AlgorithmDetails).

System.NullReferenceException: Object reference not set to an instance of an object.
   at Org.BouncyCastle.Cms.CmsSignedDataGenerator.SignerInf..ctor(CmsSignedGenerator outer, ISignatureFactory sigCalc, SignerIdentifier signerIdentifier, CmsAttributeTableGenerator sAttr, CmsAttributeTableGenerator unsAttr, AttributeTable baseSignedTable)
   at Org.BouncyCastle.Cms.CmsSignedDataGenerator.AddSignerInfoGenerator(SignerInfoGenerator signerInfoGenerator)
   at Org.BouncyCastle.Tsp.TimeStampTokenGenerator.Generate(TimeStampRequest request, BigInteger serialNumber, DateTime genTime, X509Extensions additionalExtensions)
   at Org.BouncyCastle.Tsp.TimeStampTokenGenerator.Generate(TimeStampRequest request, BigInteger serialNumber, DateTime genTime)
   ....

The problem can be solved by using sha256WithRsaEncryption (1.2.840.113549.1.1.11 - it's a newer standard) in ISignatureFactory.AlgorithmDetails, but for backward client compatibility, the rsaEncryption algorithm would be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant