Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

encryption decryption

 
rajendra peddinti
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
rajendra peddinti
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic