bouncycastle

How to sign public PGP key with Bouncy Castle in Java

泄露秘密 提交于 2020-01-02 09:37:28
问题 I'm writing PGP server to generate keys for users. I want to sign any generated PGP public key with my private key in Java with Bouncy Castle, to make it trusted for my users. I have no problems with generating key pair - it works perfect. I tried to sign by gpg --sign-key command line and it works good. But I can't get the same in Java. I tried many solutions like this: java sign public pgp key with bouncycastle and DirectKeySignature class from BC examples package, but nothing works for my.

Extracting individual .cer certificate from a .p7b file in java

心不动则不痛 提交于 2020-01-02 07:46:07
问题 I am new to Cryptography and so please excuse me if you think this is a basic question I have a .p7b file which I need to read and extract the individual public certificates i.e the .cer files and store it in the key store. I need not worry about persisting in the key store as there is already a service which takes in the .cer file as byte[] and saves that. What i want to know is , how do i read the .p7b and extract the individual .cer file? I know that can be done via the openSSL commands,

How to properly use Bouncy Castle's OAEPEncoding for RSA (Lightweight API)

与世无争的帅哥 提交于 2020-01-02 03:37:28
问题 I've been playing around with Bouncy Castle's implementation of RSA (Lightweight API) and got the basics figured out. Looking at their spec for JCE provider implementation I noticed that different padding schemes can be used with RSA. From what I understand, by default null padding is used. So I began exploring OAEP padding, particularly OAEPWithSHA512AndMGF1Padding . Searching with Google wasn't very helpful so I began digging through BC's source code and found org.bouncycastle.jce.provider

Diffie Hellman key agreement generates different key every time JAVA

萝らか妹 提交于 2020-01-01 19:45:42
问题 I am experiencing a problem with Diffie Hellman implementation. I am using this code http://www.java2s.com/Tutorial/Java/0490__Security/DiffieHellmanKeyAgreement.htm It is actually an example from one book I am reading. But I can't understand why generateSecret() creates a different key for every KeyAgreement . I have noticed the function creates different keys even if I call it with the same KeyAgreement twice! If someone has something to suggest I will be really glad! Thanks for your time!

Verify BouncyCastle ECDsa signature with .NET libraries ECDsaCng

为君一笑 提交于 2020-01-01 19:00:49
问题 An existing system generated signatures using Bouncy Castle (.NET) and I need to verify these existing signatures using the Microsoft ECDsaCng class. Consider the following code that attempts to do this: public static void InterchangeTest() { //AsymmetricCipherKeyPair bKeyPair_0 = Crypto.GenerateEcdsaKey(); String sPassPhrase = "bob is your uncle"; byte[] bPassPhrase = new UTF8Encoding(false).GetBytes(sPassPhrase); int SaltBitSize = 128; int EcdsaBitLength = 521; byte[] bSalt = new byte

Verify BouncyCastle ECDsa signature with .NET libraries ECDsaCng

≯℡__Kan透↙ 提交于 2020-01-01 19:00:11
问题 An existing system generated signatures using Bouncy Castle (.NET) and I need to verify these existing signatures using the Microsoft ECDsaCng class. Consider the following code that attempts to do this: public static void InterchangeTest() { //AsymmetricCipherKeyPair bKeyPair_0 = Crypto.GenerateEcdsaKey(); String sPassPhrase = "bob is your uncle"; byte[] bPassPhrase = new UTF8Encoding(false).GetBytes(sPassPhrase); int SaltBitSize = 128; int EcdsaBitLength = 521; byte[] bSalt = new byte

Get Private Key from BouncyCastle X509 Certificate? C#

老子叫甜甜 提交于 2020-01-01 04:27:08
问题 Normally when I grab an X509Certificate2 out of my keystore I can call .PrivateKey to retrieve the cert's private key as an AsymmetricAlgorithm . However I have decided to use Bouncy Castle and its instance of X509Certificate only has a getPublicKey(); I cannot see a way to get the private key out of the cert. Any ideas? I get the an X509Certificate2 from my Windows-MY keystore then use: //mycert is an X509Certificate2 retrieved from Windows-MY Keystore X509CertificateParser certParser = new

BouncyCastle installation problems

落爺英雄遲暮 提交于 2020-01-01 04:03:09
问题 I'm trying to add BouncyCastle as a security provider on Windows XP Pro so I can use it to add some certs to an Android application per the instructions here. Unfortunately I can't get it to add the provider. I've: Downloaded the provider to C:\Program Files\Java\jre6\lib\ext\ . Added C:\Program Files\Java\jre6\lib\ext\bcprov-jdk16-146.jar to %CLASSPATH% . Added security.provider.7=org.bouncycastle.jce.provider.BouncyCastleProvider to java.security (7 being the next int in the order). When I

BouncyCastle installation problems

青春壹個敷衍的年華 提交于 2020-01-01 04:03:08
问题 I'm trying to add BouncyCastle as a security provider on Windows XP Pro so I can use it to add some certs to an Android application per the instructions here. Unfortunately I can't get it to add the provider. I've: Downloaded the provider to C:\Program Files\Java\jre6\lib\ext\ . Added C:\Program Files\Java\jre6\lib\ext\bcprov-jdk16-146.jar to %CLASSPATH% . Added security.provider.7=org.bouncycastle.jce.provider.BouncyCastleProvider to java.security (7 being the next int in the order). When I

Sign CAdES using BouncyCastle using JAVA

非 Y 不嫁゛ 提交于 2020-01-01 00:48:38
问题 According to several posts I've found out it's now possible to perform CAdES using BouncyCastle but there is hardly any documentation on the topic. For starters I want to perform CAdES-BES without any optional signed attributes on a file with a file based certificate. In response to dander: I have something that might be helpful, you have your SignerInformation, you need to extend it, first you need to create an attribute from the timestamp, I'll assume you already have a TimeStampResponse as