bouncycastle

javax.net.ssl.SSLException illegal_parameter bouncycastle related?

I'm trying to upgrade from BouncyCastle bcprov-jdk14-124.jar (oooold) to bcprov-jdk14-143.jar. When I replace the old jar with the new jar and build everything, my software will no longer establish an SSL connection, failing with a javax.net.ssl.SSLException: Received fatal alert: illegal_parameter. Googling for "bouncycastle javax.net...

Bouncycastle Install Provider Programmatically

Is it possible to install Bouncycastle provider programmaticly without modifying security policy file? ...

Encrypt and decrypt file in J2ME

Hi guys. I'm having problem decrypting an encrypted file in J2ME using bouncy castle. What I'm trying to do is select a file to encrypt,write the encrypted file and try decrypt it back to its orginal form (write to another file for verification purpose). I have this error when reading the encrypted file. Stack Trace : s: pad block cor...

How to import DSA signature in ASN.1 format using BouncyCastle (C#)

OpenSSL, as well as most other DSA implementations, outputs signatures in ASN.1 format. Thus, the 40-byte signature (two 20-byte integers) becomes 46 bytes due to the ASN.1 structure headers. (See this forum post for details.) My question is, how does one handle this format in C#? (or elsewhere, for that matter) I spent a while trying...

Signing message with certificate: JCE, IAIK or similar in IBM SDK 5.0

So, I'm in a very difficult problem. Using Java: I've an enterprise certificate (in .p12 format) altogether with its public key ("password" string). Also I've a text message which I've to sign in PKCS7 format. I've been reading a lot and I've realized that there's no STANDARD implementation to do what I want to do. There is the JCE/JCA...

Java to Python RSA

I'm trying to encrypt a string from Java to Python, using the library Bouncy Castle J2ME on the client side and Python M2Crypto on the other. Everything is pretty good, I can decrypt it properly, but the padding is the issue. The M2Crypto lib gives me (as far as I can tell) only these Padding schemes: no_padding = 3 pkcs1_padding = 1 s...

Convert Windows CryptoAPI PRIVATE KEY BLOB to bouncy castle RsaPrivateCrtKeyParameters

Is there any way (similar to FromCapiPrivateKeyBlob in Mono) to convert a Windows CryptoAPI PRIVATE KEY BLOB to RsaPrivateCrtKeyParameters used by Bouncy Castle? ...

ECC Encryption with BouncyCastle for C#

After reading this post regarding the use ECC to implement the hashing using aa private key I set about trying to find an implementation of ECDH and came across BoucyCastle. Unfortunately documentation is minimal (as in zerow!) and I'm unsure what I'm about to accomplish is completely correct/valid. We want to simply hash 4 strings whi...

Bouncycastle encryption algorithms not provided

I'm trying to use BouncyCastle with android to implement ECDH and EL Gamal. I've added the bouncycastle jar file (bcprov-jdk16-144.jar) and written some code that works with my computers jvm however when I try and port it to my android application it throws: java.security.NoSuchAlgorithmException: KeyPairGenerator ECDH implementation n...

An example of encrypting an xml file in Java using bouncy castle.

Can anyone show me (or provide a link to) an example of how to encrypt a file in Java using bouncy castle? I've looked over bouncycastle.org but cannot find any documentation of their API. Even just knowing which classes to use would be a big help for me to get started! ...

How can I create an SHA512 digest string in Java using bouncy castle?

This unit test is failing: public void testDigest() throws NoSuchAlgorithmException { String hashExpected = "150a14ed5bea6cc731cf86c41566ac427a8db48ef1b9fd626664b3bfbb99071fa4c922f33dde38719b8c8354e2b7ab9d77e0e67fc12843920a712e73d558e197"; MessageDigest md = new MessageDigest(); String hashActual = new String(md.digest("...

Turn an byte encoded Key back into it's original ECPublicKey in Bouncy Castle

In Java I have a ECDH public Key that I am sending as a byte array. Once I have received the byte array how can I turn it back into a public key? I am using Bouncy Castle but a Java solution would be just as useful. Thanks ...

KeyStore loading causing EOFException error on Android

I have some code for my app that creates a keystore in android, creates some default keys then saves the keystore. Later on the code tries to reload the keystore, on the emulator this runs fine however when run on a phone I get an EOFException. Any advice on where I'm going wrong? An out take of the code is below: In the class I...

S/MIME in Java without JCE

I'm trying to write an applet that would sign e-mail with S/MIME. Obviously I want to make one small jar with only the required stuff. Obviously the Java way of doing that involves having a huge sacred signed Bouncy Castle JCE jar around. The question is: What's the easiest way of getting S/MIME without touching JCE and having it compl...

CMSSignedDataStreamGenerator hash does not match.

Hi! I`m writing an application that signs and envelopes data using BouncyCastle. I need to sign large files so instead of using the CMSSignedDataGenerator (which works just fine for small files) I chose to use CMSSignedDataStreamGenerator. The signed files are being generated but the SHA1 hash does not match with the original file. Co...

How to use Microsoft PKCS#9 SignerInfo attributes in a Java application?

In http://msdn.microsoft.com/en-us/library/system.security.cryptography.pkcs(VS.85).aspx we can see that the following digital signature attributes are defined: Pkcs9ContentType Pkcs9DocumentDescription Pkcs9DocumentName Pkcs9MessageDigest Pkcs9SigningTime Of those, Pkcs9DocumentDescription and Pkcs9DocumentName are not present in th...

C# How to encrypt a data file Bouncy Castle pgp?

I want to be able to send encrypted files from one app (windows forms) to another (asp.net). I've looked at bouncy castle, but there doesn't seem to be much documentation. Are there any simple bouncy castle pgp c# examples? How is pgp done in c# using bouncy castle? Is this the right approach?: Server app (winforms) has a private key...

use bouncy castle to create public key on j2me

I got the public key from the certificate, keypair is a java.security.KeyPair object String public_key = keypair.getPublic().toString(); I want to send this to the via an http connection to a J2me application. I cannot find any documentation to convert the transmitted string to a Public key that can be used to encrypt Strings. I also...

Obtaining a signed x509 when using ECDSA keys

I am trying to sign some X509 certificates. My root private key is an ECDSA secp384r1. I am using bouncy castle. What seems to happen is that when generating the certificate signature, the Signature class used is unable to understand my ECDSA key. The code that generates is as follows: X509V3CertificateGenerator v3CertGen = new X50...

Java Bouncy Castle Cryptography - Encrypt with AES.

How do I AES encrypt with the java bouncy castle library? Example code or a link to example code would be nice :) ...