where do I put the license key (trial now), but commercial later? |
Please refer the below help link to include the generated license key in Windows Forms application.
Refer to the below link which will direct you to generate the Syncfusion license key.
|
Is it possible to digitally sign a pdf using a certificate in the smartcard without using the windows store? |
We can able to sign PDF document with external signature using X509Certficate2. Please refer the below KB link for more details,
Please let us know if you need any further assistance on this.
|
But I’m still unable to get if it’s possible to achieve my
aim to digitally sign a pdf with a smart card.
I modified the sample to use my certificate as below:
private static void
Signature_ComputeHash(object sender, PdfSignatureEventArgs arguments)
{
//Get the
document bytes
byte[] documentBytes =
arguments.Data;
SignedCms signedCms = new SignedCms(new ContentInfo(documentBytes), detached: true);
//Compute
the signature using the specified digital ID file and the password
//X509Certificate2 certificate = new
X509Certificate2("DigitalSignatureTest.pfx",
"DigitalPass123");
//var
cmsSigner = new CmsSigner(certificate);
var cmsSigner = new
CmsSigner(selectedCertificate);
//Set the
digest algorithm SHA256
cmsSigner.DigestAlgorithm = new Oid("2.16.840.1.101.3.4.2.1");
signedCms.ComputeSignature(cmsSigner);
//Embed
the encoded digital signature to the PDF document
arguments.SignedData = signedCms.Encode();
}
where selectedCertificate is the certificate on the
smartcard, I can use it to encrypt custom data and I get prompted to insert my
PIN:
var privateKey = cert.PrivateKey;
var hardwareDevice =
rsa.CspKeyContainerInfo.HardwareDevice;
if (hardwareDevice) // sure - smartcard
{
string secret = "secret
text";
byte[] unsigned = Encoding.UTF8.GetBytes("secret
text");
byte[] signed = rsa.SignData(new MemoryStream(unsigned), new System.Security.Cryptography.SHA256CryptoServiceProvider());
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
//Load the existing page.
PdfLoadedPage page = loadedDocument.Pages[0] as PdfLoadedPage;
//Create PDF certificate with X509Certicate2 object.
PdfCertificate certifiate = new PdfCertificate(cert /* x509 certificate retrieved from smartcard */);
PdfSignature signature = new PdfSignature(loadedDocument, page, certifiate, "Sig1");
signature.Bounds = new RectangleF(0, 0, 200, 100);
//Save and close the PDF document.
loadedDocument.Save(“output.pdf");
loadedDocument.Close(true); |
Hello
I'm trying to sign a pdf with a smartcard
I need to identify which certificate to use, which in this case is the serial number.
How can I do it ?
the password will be indicated below.
Attached is the example code.
Use the below code snippet to get the certificates using the serial number:
Dim store As X509Store = New X509Store("MY", StoreLocation.CurrentUser) store.Open(OpenFlags.[ReadOnly] Or OpenFlags.OpenExistingOnly) Dim collection As X509Certificate2Collection = CType(store.Certificates, X509Certificate2Collection) Dim fcollection As X509Certificate2Collection = CType(collection.Find(X509FindType.FindBySerialNumber, "F85E1C5D93115CA3F969DA3ABC8E0E9547FCCF5A", True), X509Certificate2Collection) |
Try this on your end and let us know the result.