Click here to Skip to main content
14,485,669 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi all,

I am trying to sign my data by using cms signer and sha256 digest algo .

code is working fine on my machine .

but on client machine i am getting internal server error

can any one have any idea please share

it is little bit urgent .


What I have tried:

CmsSigner signer = new CmsSigner(certificate);

signer.DigestAlgorithm = new Oid("SHA256");// ("2.16.840.");
signer.SignedAttributes.Add(new Pkcs9SigningTime());
// create the signature
signer.IncludeOption = X509IncludeOption.None;

signedCms.ComputeSignature(signer, false);
Updated 1-Jun-16 6:40am
Richard Deeming 1-Jun-16 11:29am
"Internal server error" is just a message telling you that something went wrong; you'll need to track down the real error to find out what the problem is.

Assuming this is ASP.NET, there should be an entry in the application event log with more details. Alternatively, use Failed Request Tracing[^] to trace the failed request.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

It's exploding probably because "SHA256" is not proper Oid descriptor.

It should be:
signer.DigestAlgorithm = new Oid("2.16.840.");

An "Internal server error" means that you haven't properly setup the objects and/or properties required to use the Signer. There's probably more that's wrong but you're not showing enough code to make that determination.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100