File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes encryption decryption Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "encryption decryption" Watch "encryption decryption" New topic
Author

encryption decryption

rajendra peddinti
Greenhorn

Joined: Jun 05, 2007
Posts: 19
when i tried to execute the following code:




i am getting error like,

Cannot find any provider supporting RSA/ECB/PKCS5Padding
at javax.crypto.Cipher.getInstance(DashoA12275)


i am using java 1.4.2 api. do my api missing this rsa/ecb/pkcs5padding algorithm module or what??
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
Welcome to JavaRanch.

According to this, "ECB" is defined in a document called "DES Modes of Operation", which suggests to me that it may be applicable to DES, and not necessarily to RSA. Have you tried a different mode?


Ping & DNS - updated with new look and Ping home screen widget
rajendra peddinti
Greenhorn

Joined: Jun 05, 2007
Posts: 19
yeah i've tried they re working fine. but my objective is to do on "RSA". can't we do that using java api?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
My point was that ECB may not work with RSA, and that you should try a different mode (e.g. NONE), not a different cipher.

Also, this will not work:

Cipher text is binary, not text, so you can't convert it to a String like this. If you need an ASCII representation of it, use base-64 encoding.
rajendra peddinti
Greenhorn

Joined: Jun 05, 2007
Posts: 19
Ulf!
thanks for the reply. but its not problem with mode. the algorithm it self is not geting recognised.
when i debug.


it is catching. why their is no algorithm? is that problem with my api. i tried to get jce.jar but couldn't make it out.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
What JCE calls algorithm is the combination of cipher, mode and padding. Have you tried using NONE instead of ECB for the mode?
rajendra peddinti
Greenhorn

Joined: Jun 05, 2007
Posts: 19
you mean "cipher is a comibanation of algorithm,mode and padding" ?...yes, i tried NONE as mode and find no change in result.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
Originally posted by rajendra peddinti:
you mean "cipher is a comibanation of algorithm,mode and padding" ?


No, I meant what I wrote. The point is that what JCE calls algorithm is not something like RSA or DES (which it calls cipher), but the combination of that with the mode and the padding. Any introduction to JCE will explain this in detail.
rajendra peddinti
Greenhorn

Joined: Jun 05, 2007
Posts: 19
but in the link provided by you(in the your first reply of this thread)..it was like under Cipher their are three parts algorithm,mode,padding and under algorithm the rsa/des etc. were specified. i got less idea on jce.jar anyways. but what do you think is the problem with my code?
rajendra peddinti
Greenhorn

Joined: Jun 05, 2007
Posts: 19
more over instead of


when i use


i.e. no mode and no padding, even then i am getting the same error. so if i'm not wrong,error has got nothing to do with "ECB" , the Mode. what do you say??
Jeremy Botha
Ranch Hand

Joined: Feb 16, 2005
Posts: 125
Has it occured to you that NoSuchAlgorithmException is probably thrown because the cipher engine cannot find the specified algorithm/mode/padding combination you're specifying?

Print out a list of your cipher engine's supported algorithms and modes and I'm pretty sure you will not find RSA/ECB anywhere in the list.

J
rajendra peddinti
Greenhorn

Joined: Jun 05, 2007
Posts: 19
jeremy

let us assume what you said that is, error is coming because of "wrong combination", is right. but i've tried

(that is no mode and padding) which even returned the same error(refer my last post). what do you think is the acual problem?
rajendra peddinti
Greenhorn

Joined: Jun 05, 2007
Posts: 19
guys,

i just found in IBM tutorial that

RSA algorithm won't work in java1.4 and we should use a third party tool like bouncycastle.

anyways thanks for your concern.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: encryption decryption
 
Similar Threads
Problem with Cryptography!!!
Please send me one example of Encryption/Decryption
RSA Cipher
crytography
signer information does not match? Help...