pkcs#7

How can I check signature of a SignedCms envelope?

人盡茶涼 提交于 2021-02-08 10:00:13
问题 I don't really understand how to work with PKCS#7 messages. I sign some byte array with a X509Certificate2 I have and get also a byte array. byte[] data = new byte[5] { 110, 111, 112, 113, 114 }, signedData; X509Certificate2 cert = new X509Certificate2(certPath, password); ContentInfo content = new ContentInfo(data); SignedCms envelope = new SignedCms(content); CmsSigner cmsSigner = new CmsSigner(cert); envelope.ComputeSignature(cmsSigner); signedData = envelope.Encode(); The signedData is

Sign pdf asynchronously using digest

痴心易碎 提交于 2021-02-06 09:32:46
问题 I'm trying to do the following setup for signing pdfs, broken down into asynchronous steps between a client and a server: A server receives a pdf and computes it's digest. Server sends the digest to a client. Client signs the hash at a later time. Client sends the signature to server. Server embeds the signature into the pdf. I'm basing myself mainly in PDF Signature digest and Create pkcs7 signature from file digest The second question allowed me to write most of the code, however I'm

Sign pdf asynchronously using digest

只愿长相守 提交于 2021-02-06 09:32:10
问题 I'm trying to do the following setup for signing pdfs, broken down into asynchronous steps between a client and a server: A server receives a pdf and computes it's digest. Server sends the digest to a client. Client signs the hash at a later time. Client sends the signature to server. Server embeds the signature into the pdf. I'm basing myself mainly in PDF Signature digest and Create pkcs7 signature from file digest The second question allowed me to write most of the code, however I'm

Instantiate java.security classes PrivateKey and X509Certificate from .key and .cer files

与世无争的帅哥 提交于 2021-01-29 09:33:17
问题 The original goal is: Generate a https url where one of parameters is PKCS7 detached signature (RSA, SHA-256, UTF-8, BASE64). What do I have: private key (.key file begin with "-----BEGIN RSA PRIVATE KEY-----", end like this "kIng0BFt5cjuur81oQqGJgvU+dC4vQio+hVc+eAQTGmNQJV56vAHcq4v -----END RSA PRIVATE KEY-----") self signed certificate (.cer file begin with "-----BEGIN CERTIFICATE-----", end like this "xwRtGsSkfOFL4ehKn/K7mgQEc1ZVPrxTC7C/g+7grbKufvqNmsYW4w== -----END CERTIFICATE-----") data

Sign Xml with digital certificate in format of PKCS#7 in DER (ITU-T Rec. X.690)

假装没事ソ 提交于 2021-01-28 18:22:16
问题 I have a .xml file that has to be signed with digital certificate in format of PKCS#7 version 1.5 (RFC 2315) and DER (ITU-T Recommendation X.690 That .xml will be send to a govt. WebService that only accept the format I mentioned upwards. What I'm able to do - thanks to this website is digitaly sign .xml with the .pfx file that I generated with Certificate Export Wizard explained below. The class that I'm using to sign is down on mentioned website or here. From what I tried to understand so

Error validating CMS signature

不问归期 提交于 2021-01-28 09:21:03
问题 For the past 2 weeks I've been banging my head against a wall trying to create and validate CMS signatures in Swift 4 using OpenSSL. My code is ultimately destined to be run on Linux, so I can't use the macOS Security framework. I believe I have finally gotten CMS signature creation working properly. My code for that looks like this: let testBundle = Bundle(for: type(of: self)) guard let textUrl = testBundle.url(forResource: "test_message", withExtension: "txt"), let signingKeyUrl =

C# PKCS7 Smartcard Digital Signature - Document has been altered or corrupted since it was signed

我怕爱的太早我们不能终老 提交于 2021-01-27 21:17:49
问题 I try to sign a pdf file using my smartcard (USB token) but encounter "Document has been altered or corrupted since it was signed" error when I open the signed pdf file in Adobe. The error is not so descriptive and I'm not sure where to look at because the code seems good to me but apparently it's not.. The code that I use is: var signer = smartCardManager.getSigner("myTokenPassword"); var toBeSignedHash = GetHashOfPdf(File.ReadAllBytes(@"xxx\pdf.pdf"), cert.asX509Certificate2().RawData, "dsa

Programmatically signed PDF document does not get the green checkmark after being signed using Acrobat Reader

北城余情 提交于 2021-01-07 03:52:58
问题 I have written an application to sign PDF documents and now I am able to sign any non-signed PDF document, and Adobe Reader shows the green checkmark. Moreover I can sign a file with multiple signatures and the results are ok. But if I try to sign the document using Adobe Reader, when I sign it again, the result is that any signature prior to the last one does not get the green checkmark because Acrobat thinks that the document has changed. Then, if I sign the document again using Adobe