For Programmers: Free Programming Magazines  


Home > Archive > Java Security > July 2004 > Java Provider for RSA/ECB/PKCS#1









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Java Provider for RSA/ECB/PKCS#1
Chris Duwenkamp

2004-07-05, 3:59 pm

Hi!

Is there any java Provider for encryption with rsa/ecb/pkcs#1 for texts
longer than the keysize?

I have tried BouncyCasle and Cryptix, but both give me errors, that the text
is to long...

so it seems, that they don't splitt the text in blocks themselves...

ThanX,
Chris

PS: I know, that normaly you shouldn't encrypt large texts with RSA but
their is no way around it
in my App...


Michael Amling

2004-07-05, 8:57 pm

Chris Duwenkamp wrote:
>
> Is there any java Provider for encryption with rsa/ecb/pkcs#1 for texts
> longer than the keysize?
>
> I have tried BouncyCasle and Cryptix, but both give me errors, that the text
> is to long...
>
> so it seems, that they don't splitt the text in blocks themselves...
>
> ThanX,
> Chris
>
> PS: I know, that normaly you shouldn't encrypt large texts with RSA but
> their is no way around it in my App...


Encrypt the data with AES, using a proper mode and a MAC, both with
keys selected at random by SecureRandom, then encrypt the AES encryption
key and the MAC key with RSA.

--Mike Amling

Greg Stark

2004-07-05, 8:57 pm


"Chris Duwenkamp" <chris@duwenkamp.de> wrote in message
news:2ktedbF69vj3U1@uni-berlin.de...
> Is there any java Provider for encryption with rsa/ecb/pkcs#1 for texts
> longer than the keysize?
>



I've never header of any provider with this capability, so you'll have to do
it
yourself. It should not be too hard; you just have to think about how many
bytes are available for your data in a given RSA block. It depends on
the details of the padding scheme you choose.

--
===================
Greg Stark
notgreg_stark@pobox.com
remove the "not" to get my address
===================


Harry Potter

2004-07-09, 4:02 pm

I do not know but I a cannot find an example of RSA encryption on the
internet ('cause of restrictions), but I know Cryptix is able to use it.
What does your code look like?

Chris Duwenkamp wrote:

> Hi!
>
> Is there any java Provider for encryption with rsa/ecb/pkcs#1 for texts
> longer than the keysize?
>
> I have tried BouncyCasle and Cryptix, but both give me errors, that the text
> is to long...
>
> so it seems, that they don't splitt the text in blocks themselves...
>
> ThanX,
> Chris
>
> PS: I know, that normaly you shouldn't encrypt large texts with RSA but
> their is no way around it
> in my App...
>
>


Roedy Green

2004-07-09, 9:01 pm

On Fri, 09 Jul 2004 12:50:46 -0400, Harry Potter <harrypotter@aol.com>
wrote or quoted :

>I do not know but I a cannot find an example of RSA encryption on the
>internet ('cause of restrictions), but I know Cryptix is able to use it.
>What does your code look like?


If you want to see it done without JCE, using just BigInteger, have a
look at the source for http://mindprod.com/products.html#WRAPPER

The actual guts of it is just one line of code.


--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com