java.security.NoSuchAlgorithmException: Cannot find any provider supporting

Hi All

I am using J2SE1.4.2_09 and trying a RSA based encryption and decryption program.

I get the following exception,

java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/ECB/PKCS1Padding

at javax.crypto.Cipher.getInstance(DashoA12275)

at RSAEncrypt.<init>(RSAEncrypt.java:56)

at RSAEncrypt.main(RSAEncrypt.java:96)

The code is

public RSAEncrypt(String inFileName, String outFileName) {

try {

/* Get the secret message from file. */

FileInputStream plainfile = new FileInputStream(inFileName);

byte[] plaintext = new byte[plainfile.available()];

plainfile.read(plaintext);

plainfile.close();

/* Get the public key from file. */

PublicKey publickey = readPublicKey("publickey.txt");

/* Create a cipher for encrypting. */

Cipher encrypt_cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");

encrypt_cipher.init(Cipher.ENCRYPT_MODE, publickey);

/* Encrypt the secret message and store in file. */

byte[] ciphertext = encrypt_cipher.doFinal(plaintext);

FileOutputStream cipherfile = new FileOutputStream(outFileName);

cipherfile.write(ciphertext);

cipherfile.close();

} catch (Exception e) {

e.printStackTrace();

}

}

I tried some steps like,

Cipher encrypt_cipher = Cipher.getInstance("RSA");

Still I get the same error.

Please help me.

Regards

Kathirvel

[1528 byte] By [kathirvel.balakrishnana] at [2007-10-3 11:08:48]
# 1
RSA is not available in the SunJCE provider as part of 1.4.2. You could use Bouncy Castle (BC) provider available from www.bouncycastle.org
sabre150a at 2007-7-15 13:31:49 > top of Java-index,Security,Cryptography...
# 2
Thanks...RegardsKathirvel
kathirvel.balakrishnana at 2007-7-15 13:31:49 > top of Java-index,Security,Cryptography...