hi ther, i am trying to implement this prg on servlets but it says Algorithm not found...but the code is working perfectly on the console..... import java.io.*; import com.dstc.security.provider.*; import javax.crypto.*; import javax.crypto.Cipher.*; import java.security.*; import javax.servlet.*; import javax.servlet.http.*; import java.security.spec.*; import java.security.interfaces.*;
// Print out the bytes of the plaintext //out.println("\nPlaintext: "+plaintext);
for (int i=0;i<plaintext.length;i++) {
out.print(plaintext[i]+" "); } // Perform the actual encryption byte[] ciphertext = cipher.doFinal(plaintext); // Print out the ciphertext out.println("\n\nCiphertext: "); String s=null; for (int i=0;i<ciphertext.length;i++) {
out.print(ciphertext[i]+" ");
} s = ciphertext.toString(); out.println("The CypherText is "+s); // Re-initialize the cipher to decrypt mode cipher.init(Cipher.DECRYPT_MODE, key);
// Perform the decryption byte[] decryptedText = cipher.doFinal(ciphertext); String output = new String(decryptedText,"UTF8"); out.println("\n\nDecrypted text: "+output); } catch(Exception e){
out.println(e.getMessage()); }
}
} please do help me asap.. Rao
Rao<BR>Sun Certified Programmer for the Java��� 2 Platform
Cipher cipher = Cipher.getInstance("DES"); What object Cipher? What does it do? What package is it from? Just curious.
raghavender rao
Ranch Hand
Joined: Jul 20, 2001
Posts: 45
posted
0
hi all,
i tried registering provider dynamically Security.addProvider(new DSTC()); where DSTC is a Security Provider... Mr Peter i cant download JCE coz i am not in Canada or US.... Algorithm not found by KeyGenerator....
Mr Jamie Cipher is a class in javax.crypto package com.dstc.*; please help to solve this problem
David Bejjam
Greenhorn
Joined: Aug 16, 2001
Posts: 17
posted
0
Hi, JCE is now downloadable even outside US, check it out at the javasoft site. Try out your programs with jdk1.4beta becoz JCE is bundeled with it. bye
raghavender rao
Ranch Hand
Joined: Jul 20, 2001
Posts: 45
posted
0
hi sir. i tried using jdk1.4 but it dosent work with servlets
Rao
raghavender rao
Ranch Hand
Joined: Jul 20, 2001
Posts: 45
posted
0
hi sir. i tried using jdk1.4 but it dosent work with servlets