Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to involve Signer’s certificate issuer name,serial number & Date/time stamp while signing a data in c#?

I am doing digital signature via Rebex dll.
My code is as follows:

C#
// get a certificate with a private key
var certificate = Certificate.LoadPfx("mycert.pfx", "password");

// load the content of a file we need to sign
byte[] content = File.ReadAllBytes("document.pdf");
var contentInfo = new ContentInfo(content);

// create a PKCS #7 SignedData object based on this,
// the second argument specifies "detached" style
var signedData = new SignedData(contentInfo, true);

// add one ore more signers
var signer = new SignerInfo(certificate);
signedData.SignerInfos.Add(signer);

// create the signature
signedData.Sign();

// save the signature into a detached signature file
using (var output = File.Create("document.pdf.p7s"))
{
    signedData.Save(output);
}
Posted
Updated 16-Jun-15 5:04am
v2
Comments
virusstorm 16-Jun-15 11:56am    
I'm not sure I'm following what your issue is.
Alex345098 16-Jun-15 23:50pm    
I want to include signer's issuername,date/time stamp while signing the data.
I want to do these using Rebex or through any other option in c#

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900