File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Security and the fly likes signer information does not match? Help... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "signer information does not match? Help..." Watch "signer information does not match? Help..." New topic

signer information does not match? Help...

John Peter

Joined: Jul 13, 2004
Posts: 8
Dear all,
I have implemented an RSA with BC provider using JCE as platform.
FYI,I am using j2sdk1.4.2_05 in Windows 98.

But I hits the following error:
class "org.bouncycastle.crypto.params.ParametersWithRandom 's signer
information does not match signer information of other classes in the same
package. Null pointer exception in "cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPublic());"

The code is like follow:
import javax.crypto.*;
import org.bouncycastle.jce.provider.BouncyCastleProvider;

public class PublicCipher{

private static final int KEY_SIZE = 1024;

public static void main(String [] args) throws Exception{
byte [] plainText = "This is a session".getBytes("UTF8");

Security.addProvider(new BouncyCastleProvider());

KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA");

KeyPair keyPair = gen.generateKeyPair();
System.out.println("RSA Key pair generated.");
Cipher cipher = null;

//obtain RSA Cipher

cipher =

}catch(Exception e){



//encrypt with public key.
cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPublic());
byte [] cipherText = cipher.doFinal(plainText);
System.out.println(new String(cipherText,"UTF8"));

//decrypt with private key
cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPrivate());
byte [] newPlainText = cipher.doFinal(cipherText);
System.out.println(new String(newPlainText,"UTF8"));



Please help me.
Thanks in advance.

John Peter

I agree. Here's the link:
subject: signer information does not match? Help...
It's not a secret anymore!