Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / October 2003

Tip: Looking for answers? Try searching our database.

Ciphertext different each time I encode it with the same public key

Thread view: 
Digby - 09 Oct 2003 07:47 GMT
Hi,

I've started playing around creating public and private keys and using them
to encrypt byte[]s.

I've noticed that the same public key encrypts the same plain text as
different cipertext (or bytes) each time I run the code, although when I
decrypt with the private key, I do get the original plain text back.

Is this expected funtionality? I'm using an RSA cipher on Java1.4.1 with the
BouncyCastle provider installed.

TIA

Digby
Michael Amling - 09 Oct 2003 14:08 GMT
> I've started playing around creating public and private keys and using them
> to encrypt byte[]s.
[quoted text clipped - 5 lines]
> Is this expected funtionality? I'm using an RSA cipher on Java1.4.1 with the
> BouncyCastle provider installed.

  Yes, the naive use of c=m**e mod n is subject to certain attacks, so
randomized "padding" of the message m is needed to preclude those
attacks. I haven't looked at the padding scheme that Bouncy Castle uses,
but it could be OAEP, which is a good padding scheme. The output is
c=OAEP(m)**e mod n. OAEP xors the message with hashed output of a random
number. Bouncy Castle comes with source, right? So you could search the
source to find the padding algorithm.
  You'll also find that repeated digital signatures of the same
document are all different.

--Mike Amling
Digby - 09 Oct 2003 20:22 GMT
Thanks. Think I've got a bit to learn!

> > I've started playing around creating public and private keys and using them
> > to encrypt byte[]s.
[quoted text clipped - 17 lines]
>
> --Mike Amling


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.