signing

Signing and verifying signatures with RSA C#

被刻印的时光 ゝ 提交于 2019-11-26 04:39:45
问题 I recently posted about issues with encrypting large data with RSA, I am finally done with that and now I am moving on to implementing signing with a user\'s private key and verifying with the corresponding public key. However, whenever I compare the signed data and the original message I basically just get false returned. I am hoping some of your could see what I am doing wrong. Here is the code: public static string SignData(string message, RSAParameters privateKey) { //// The array to

Sign PDF with plain JavaScript

拥有回忆 提交于 2019-11-26 01:27:51
问题 With WebCrypto API evolving and being supported by Chrome and Firefox, I would like to use it for digitally signing a PDF document. There is not much of literature around, but I found some examples [1] and a library called PKI.js [2]. In the examples, the signing process is described, but in the end, a signature is returned. I would expect my Base64 PDF file returned again in a signed Base64 string, but sadly, this is not what happens. PKI.js too, to my knowledge, does not provide a way to

API/Library to replace signtool.exe

家住魔仙堡 提交于 2019-11-25 15:19:23
The Windows SDK ships with a tool called signtool.exe that lets you sign a file with a certificate. I need to do the same thing but in a background service so I'm on the lookout for a library (preferably managed code, but COM will do) to do the same thing. Any ideas? Found the answer. Here's how to use an X.509 certificate to sign a file in .NET: CmsSigner signer = new CmsSigner(); signer.Certificate = new X509Certificate2(certificate); SignedCms content = new SignedCms(new ContentInfo(File.ReadAllBytes(fileToSign))); content.ComputeSignature(signer, true); byte[] signedFile = content.Encode()