Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help in Encoding a String using Cipher

Status
Not open for further replies.

moonoo

Programmer
May 17, 2000
62
US
Hi ,
I am encoding a string using the follwing code
Cipher cipher = Cipher.getInstance("DES/OFB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[]inputBytes = input.getBytes("UTF8");
//Encode
byte[] outputBytes = cipher.doFinal(inputBytes);
BASE64Encoder encoder = new BASE64Encoder();
String base64 = encoder.encode(outputBytes);
return base64;

But it gives "Cannot find any provider supporting DES/OFB/PKCS5Padding" Exception . I have tried with other paddings also , it gives the same probelm . Kinldy help in resolving this.
Regards
deb
 
Have you got jsse.jar in HAVA_HOME/jre/lib ?

Does this enc work : DES/ECB/PKCS5Padding ?

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Hang on, I don't mean the JSSE, I mean JCE ...

Check that sunjce_provider.jar is in your CLASSPATH (or JAVA_HOME\jre\lib\ext)

If not, then download it :
Check this encoding : DES/ECB/PKCS5Padding

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Thanks for the Reply . I have this already in by CLASSPATH.
I have already checked for the other encoding DES/ECB/PKCS5Padding
 
Are you sure ? The error you are getting pretty much says it cannot find the JCE ...

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top