digital-signature

Verify digital signature using certificate chain in java

倖福魔咒の 提交于 2020-02-29 07:00:45
问题 i try to sign pdf using digital signature, i send hash value of pdf to REST API it does sign pdf using user's private key and returns CMS formatted data. I got certificate chain from CMS. Now i need to verify original pdf using the certificate chain and add signature to pdf. I use BC and Itextpdf public static String verifyPdf(byte[] toVerify, byte[] signedByte, String origFile, String signedFile) throws Exception { // CMSSignedData cms = new CMSSignedData(signedByte); // Store store = cms

How to convert OpenSSL digital signature to ASN1?

拥有回忆 提交于 2020-01-25 21:52:33
问题 Using the openssl library I have created a digital signature of a file. I can see that if I use the openssl command: openssl rsautl -verify -inkey pubkey.pem -pubin -asn1parse -in sigfile I get a nice output of something like: 0:d=0 hl=2 l= 49 cons: SEQUENCE 2:d=1 hl=2 l= 13 cons: SEQUENCE 4:d=2 hl=2 l= 9 prim: OBJECT :sha256 15:d=2 hl=2 l= 0 prim: NULL 17:d=1 hl=2 l= 32 prim: OCTET STRING 0000 - c9 8c 24 b6 77 ef f4 48-60 af ea 6f 49 3b ba ec ..$.w..H`..oI;.. 0010 - 5b b1 c4 cb b2 09 c6 fc

How to generate Public/Private key pairs using openssl in nodejs?

与世无争的帅哥 提交于 2020-01-25 10:53:05
问题 I'm beginner in nodejs.As Im implementing digital signatures in nodejs, So I want to generate public/private key pairs using openssl in node.js. I have already seen this post Can't verify signature witn Node.js Crypto, using key pairs, using key pairs. It is using following commands to generate key pairs. $ openssl genrsa -out rsa_1024_priv.pem 1024 $ openssl rsa -in rsa_1024_priv.pem -out rsa_1024_pub.pem -outform PEM -pubout Now I have following questions regarding this. How can we execute

Replicating / verifying XMLDSig from a SOAP request in python

流过昼夜 提交于 2020-01-25 08:07:16
问题 I'm trying to replicate a XMLDSig from a gSOAP webservice using WS-Security, but the signatures never match. The service uses rsa-sha1, and I have access to both, public and private key. I'm grabbing the bytestring of the element via regex including the trailing tabs (b'\t'), so it is identical to the original byte-by-byte, and I'm trying to sign it using the same private key (alternatively, I've tried verifying the signature with the public key), but to no avail. Currently I'm trying my luck

How to Read a certificate from Usb Token(etoken pro 72 k(Java) )and attach to pdf

早过忘川 提交于 2020-01-25 03:45:10
问题 I want to read the signature from Usb token safenet (alladin etoken pro 72 k(Java)) and attach to pdf. I dont know how to do this. In previously they given an option to export .pfx file. Now they are giving an option to export .cer file. When i googled i get this code. When i run this code works it prompts the password of the token after enter the password i can able to verify the signature but i dont know how to attach the signature to the pdf. please guide me whether i am in correct

Can't get ECDSA signature to validate with public key

∥☆過路亽.° 提交于 2020-01-24 22:12:29
问题 I'm running out of ideas as to why my sample code won't verify the given EC public key, signature and message. I've converted the signature to ASN.1 format which is 70 bytes and the public key is 64 bytes plus uncompressed byte (0x04). I've also tried converting the message to SHA256 hash but that didn't work as well. The publicKey hex value is used to construct a ECPublicKey with prime256v1 curve. The signature is base64 decoded then formatted to ASN.1. I don't see what I could be doing

External signing PDF with iText (2) [closed]

无人久伴 提交于 2020-01-24 01:10:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 13 days ago . Following External signing PDF with iText by Grazina, and reading the mkl answer on that post, I currently have invalid signature (syntax error), even after adding the hash prefix. Current code: private void SignPDFCore(string pdfFilePath) { var chain = this.GetUserCertificates(userId, ProgramV2

External signing PDF with iTextsharp (3)

痴心易碎 提交于 2020-01-23 17:27:05
问题 Need to sign PDF by using an external webservice that signs the document hash, the process has to be done in 2 steps, and using a temporary empty signature. Following Priyanka question and Grazina question and reading the mkl answers on that posts, I currently have invalid signature, even after adding the hash prefix like Grazina did. iTextSharp version: 5.5.13.1 This program is another aproach to my previous question. Current code (compiles and starts calling SignPDF method): public class

Digitally sign in PHP using private key, verify in C#

让人想犯罪 __ 提交于 2020-01-23 09:49:26
问题 I am working on a feature that needs me to digitally sign a short string in PHP, and verify the string's signature in C#. I would really like to use openssl_sign in PHP, because of its simplicity, but all the information I can find on Google indicates that this will not work. There are some external libraries that claim to do this well, however as this is a hobby project I would rather not purchase such a library. So what are the alternatives here? Full interoperability between C# and PHP is

PdfPKCS7 .verify() return false

别等时光非礼了梦想. 提交于 2020-01-23 04:00:09
问题 I have been working with itextpdf-5.5.5, and the Integrity check return false. PdfPKCS7 pkcs7 = fields.verifySignature(name); pkcs7.verify();<------ HERE return false But Adobe Acrobat Reader say: Signed and all signatures are valid. :( This is the document: Test.pdf. Could someone explain what is happening?. Thanks in advance 回答1: The CMS signature container embedded in your PDF has some questionable properties. In particular it has an encapsulated content, even though it merely is a byte