digital-signature

Digital signature made in C# does not verify in C++

会有一股神秘感。 提交于 2019-12-21 19:45:52
问题 I have a C# application which digitally signs data using RSA. The code is as follows: RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); rsa.ImportCspBlob(privateKeyBlob); SHA1 sha1 = new SHA1CryptoServiceProvider(); sha1.ComputeHash(myData); byte[] signature = rsa.SignHash(sha1.Hash, CryptoConfig.MapNameToOID("SHA1")); I cannot verify the signature in C++. The code is as follows: HCRYPTPROV cryptProvider; CryptAcquireContext(&cryptProvider, 0, 0, PROV_RSA_FULL, CRYPT

Verify if a PDF is digitally signed with iText

青春壹個敷衍的年華 提交于 2019-12-21 19:43:17
问题 As the title says I want to know if a given PDF file is already digitally signed. I used iText to sign it but I'm not able to know if it is already signed to eventually resign it or perform other actions. Is there a way to do it simply (possibly using iText)? 回答1: Using iText: PdfReader reader = new PdfReader(...); AcroFields acroFields = reader.getAcroFields(); List<String> signatureNames = acroFields.getSignatureNames(); Now signatureNames contains the names of all reachable signature

Combining All of the Tasks Needed to Verify a PKCS#7 Signature

£可爱£侵袭症+ 提交于 2019-12-21 15:01:01
问题 I've been banging my head against the wall with this problem for about 20 hours now and I am probably missing something easy. However, I've gotten to the point where I think I need help. I have read dozens of explanations for how to do different parts of the problem, but I cannot figure out how to bring them all together. I have a DER-encoded detached PKCS#7 digital signature. The signature conforms to RFC 3852 (Cryptographic Message Syntax). For my project I need to step through each of the

Combining All of the Tasks Needed to Verify a PKCS#7 Signature

蹲街弑〆低调 提交于 2019-12-21 14:59:51
问题 I've been banging my head against the wall with this problem for about 20 hours now and I am probably missing something easy. However, I've gotten to the point where I think I need help. I have read dozens of explanations for how to do different parts of the problem, but I cannot figure out how to bring them all together. I have a DER-encoded detached PKCS#7 digital signature. The signature conforms to RFC 3852 (Cryptographic Message Syntax). For my project I need to step through each of the

Windows CryptoAPI: CryptSignHash with CALG_SHA_256 and private key from MY keystore

大兔子大兔子 提交于 2019-12-21 05:42:20
问题 I am trying to generate digital signatures on Windows (from XP SP3, but currently testing with Windows 7) with CryptoAPI that will be compatible with the following openssl commands: openssl dgst -sha256 -sign <parameters> (for signing) openssl dgst -sha256 -verify <parameters> (for validation) I want to use a private key from the Windows "MY" keystore for signing. I managed to sign files using the SHA1 digest algorithm by using the following CryptoAPI functions (omitting parameters for

Unable to verify digital signature using Apache PDFBOX

杀马特。学长 韩版系。学妹 提交于 2019-12-21 05:07:42
问题 I am a newbie in using Digital Signatures. In one of the projects we are using Apache PdfBox for processing digitally signed pdf files. While we could test all features, verification of signed pdf files is something we are unable to crack. We are using BouncyCastle as the provider. Below is the code: //Get Digital Signature and Signed Content from pdf file byte[] signatureAsBytes = pdsignature.getContents(new FileInputStream(this.INPUT_FILE)); byte[] signedContentAsBytes = pdsignature

Separate digest & signing using java security provider

喜夏-厌秋 提交于 2019-12-21 03:21:29
问题 Due to some implementation detail, I need to split hashing and signature generation. I tried to achieve this using the 'NONEwithRSA' signature algorithm. This is a basic working example: public void rsaSignatureIntegrityTest() { KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA"); gen.initialize(2048, new SecureRandom()); KeyPair pair = gen.generateKeyPair(); byte[] digest = MessageDigest.getInstance("SHA-256").digest(MESSAGE); Signature signer = Signature.getInstance("NONEwithRSA");

Separate digest & signing using java security provider

a 夏天 提交于 2019-12-21 03:21:07
问题 Due to some implementation detail, I need to split hashing and signature generation. I tried to achieve this using the 'NONEwithRSA' signature algorithm. This is a basic working example: public void rsaSignatureIntegrityTest() { KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA"); gen.initialize(2048, new SecureRandom()); KeyPair pair = gen.generateKeyPair(); byte[] digest = MessageDigest.getInstance("SHA-256").digest(MESSAGE); Signature signer = Signature.getInstance("NONEwithRSA");

Timestamping using TSA URL and Java APIs

被刻印的时光 ゝ 提交于 2019-12-21 02:55:26
问题 Can anyone please help me in understanding the process and Java APIs used while timestamping a signature. I need to sign a file and timestamp it using TSA url "http://timestamp.globalsign.com/scripts/timstamp.dll" using Java APIs. I am able to sign the file using java.security APIs but unable to timestamp it. 回答1: Your question is a bit broad... I will give you some info which I hope it will point you on the right direction. The thing is that you want to use a timestamp service to perform a

android verify signature of file with .der public key

末鹿安然 提交于 2019-12-20 17:29:32
问题 I'm trying to verify the signature of a file. I followed these instruction to generate a certificate: // generate a private key with size of 2048 bits openssl genrsa -out private_key.pem 2048 // derive a public key from the above private key openssl rsa -in private_key.pem -out public_key.pem -outform PEM -pubout // iOS will not import PEM encoded data so it needs to be converted to DER encoded data openssl rsa -pubin -inform PEM -outform DER -in public_key.pem -out public_key.der // generate