Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

signer information does not match? Help...  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 java.security.*;
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");
gen.initialize(KEY_SIZE);

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

try{
//obtain RSA Cipher

cipher =
Cipher.getInstance("RSA/ECB/PKCS1Padding","BC");
System.out.println(cipher.getProvider().getInfo());

}catch(Exception e){

System.out.println("err1"+e.toString());

}

//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.

Regards,
John Peter

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!