my dog learned polymorphism*
The moose likes Beginning Java and the fly likes Have a problem when encrypt by RSA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Have a problem when encrypt by RSA" Watch "Have a problem when encrypt by RSA" New topic
Author

Have a problem when encrypt by RSA

ba thong
Greenhorn

Joined: Mar 08, 2009
Posts: 6
I have a method

I write a class test this method

when I execute the minutes each are different results for each
help me please, thanks a lot of
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
Does "ReadPublicKey("publicReceiver.k")" return the same result each time it is called? If not, then all bets are off.

Note that encrypted stuff is binary data, not text - so an operation like "new String(encrypted stuff)" does not make sense, and will lead to unexpected results.

What do you mean by "when I execute the minutes" - are you running this code several times within a few minutes, or what?


Ping & DNS - updated with new look and Ping home screen widget
ba thong
Greenhorn

Joined: Mar 08, 2009
Posts: 6
Ulf Dittmer wrote:Does "ReadPublicKey("publicReceiver.k")" return the same result each time it is called? If not, then all bets are off.

Ok it here



Note that encrypted stuff is binary data, not text - so an operation like "new String(encrypted stuff)" does not make sense, and will lead to unexpected results.


I have two method so that show result encrypt and decrypt format String

I continue test, when i write

The result is data1 unlike data2 !! Why ??? hixhix.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Have a problem when encrypt by RSA
 
Similar Threads
RSA Cipher
inputStream freezes
problem with RSA..... folks please help!
BadPaddingException: Data must start with zero
need to generate RSA keys from txt files