bouncycastle

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

Java Diffie-Hellman key exchange

旧城冷巷雨未停 提交于 2019-12-21 05:07:03
问题 I'm trying to execute code to perform the Diffie-Hellman key exchange. I sourced the code from an example online (forget where now). I had to import the bouncycastle.jar, which I assumed worked up until execution. my code: package testproject; import java.math.BigInteger; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.MessageDigest; import java.security.SecureRandom; import java.security.Security; import javax.crypto.KeyAgreement; import javax.crypto

How can I convert a BouncyCastle X509Certificate to an X509Certificate2?

笑着哭i 提交于 2019-12-21 05:05:35
问题 Is there any way to convert a Org.BouncyCastle.X509.X509Certificate to System.Security.Cryptography.X509Certificates.X509Certificate2 ? The inverse operation is easy, combining Org.BouncyCastle.X509.X509CertificateParser with System.Security.Cryptography.X509Certificates.X509Certificate2.Export() . 回答1: Easy!! using B = Org.BouncyCastle.X509; //Bouncy certificates using W = System.Security.Cryptography.X509Certificates; W.X509Certificate2 certificate = new W.X509Certificate2(); certificate

Why is desktop AES file IO incompatible with Android AES file IO?

自闭症网瘾萝莉.ら 提交于 2019-12-21 02:42:13
问题 I have ported an application from Android to desktop that uses AES to encrypt some private data. Both applications are able to encrypt and decrypt the data for their own use but unable to decrypt the other applications data. The AES keys, IVs, and algorithms are identical. The main difference between the two applications is that the android-sdk comes with the BouncyCastle provider already added to the security while the desktop application needed Security.addProvider(new org.bouncycastle.jce

JAVA: How to save a private key in a pem file with password protection

时光毁灭记忆、已成空白 提交于 2019-12-21 01:06:56
问题 I am trying to save a private key in a pem file, protected with a password. The problem is, the pem file is created and I can even open it with openssl but, no password is asked! Here is the code: KeyPairGenerator keygen = KeyPairGenerator.getInstance("RSA"); keygen.initialize(2048); KeyPair keypair = keygen.generateKeyPair(); PrivateKey privKey = keypair.getPrivate(); PKCS8Generator encryptorBuilder = new PKCS8Generator(privKey); encryptorBuilder.setPassword("testing".toCharArray());

Codes to generate a public key in an elliptic curve algorithm using a given private key

给你一囗甜甜゛ 提交于 2019-12-20 11:33:25
问题 I need to implement ECC (Elliptic Curve Cryptography) algorithm using jdk 1.7. I tried using bouncy castle, sunEC, but all of them gave errors and errors. My target is to generate an elliptic curve using the private key, I will be given to the system. Thus, I need to get a accurate code to generate a public key using a given private key using jdk1.7. The IDE I use is ecllipse. And I need to know, what are the other parameters I should be given other than a private key? Is it enough to provide

Verifying PDF Signature in Java using Bouncy Castle and PDFBox

浪尽此生 提交于 2019-12-20 04:03:54
问题 I am trying to verify digitally signed PDF document in Java. I'm using Apache PDFBox 2.0.6 to get the signature and the original PDF that was signed, then I'm using Bouncy Castle to verify detached signature(calculate the hash of the original file, verify the signature using signer's public key and compare the results). I read this article and tried to get the signature bytes and the original PDF bytes using this code: PDDocument doc = PDDocument.load(signedPDF); byte[] origPDF = doc

which OpenSSL version is used in bouncycastle library?

烂漫一生 提交于 2019-12-20 02:51:19
问题 I am using BouncyCastle Library for OpenSSL encryption in Android. My library version is 1.45. I would like to know the OpenSSL version is used in the library. Anybody can help me how could I find it out ? 回答1: BouncyCastle implement with java. It doesn't need OpenSSL at all. org.bouncycastle.openssl package in bcpkix is use to handle the PEM file generated by OpenSSL. https://www.bouncycastle.org/docs/pkixdocs1.5on/org/bouncycastle/openssl/package-summary.html 来源: https://stackoverflow.com

.Net Programmatically Sign PKCS#10 Request with Bouncy Castle

ぃ、小莉子 提交于 2019-12-19 20:12:07
问题 We have a valid PKCS#10 Certificate Request generated on the Client using CertEnroll. Now we need to sign it and return the result to the Client, where CertEnroll will handle the local Certificate Store stuff. This is a B2B application and the root signing certificate will be self-generated or we can use our existing Thawte SSL cert. The Server (2008) does not have Active Directory running and we don't want to create a stand-alone signing infrastructure/service for this unless absolutely