> I had assumed this was a symmetric cipher. It didn't occur to me that
>the OP could be trying to use public key crypto.
>> I had assumed this was a symmetric cipher. It didn't occur to me that
>>the OP could be trying to use public key crypto.
>
> He did not say. I have written a public key encryption using just
> BigInteger so it could be used in Applets for old JVMs.
If it's RSA, don't forget the padding. OAEP, PSS SAEP+ are hard to
implement with just BigInteger.
>
> It it pretty simple. Mr. Tines posted the core of it a few years ago.
--Mike Amling
Michel Gallant - 30 Apr 2004 15:04 GMT
The most common padding PKCS #1.5 is pretty easy to implement (for either
signature blocks, where padding is nulls, or encyrption blocks where padding is random).
Then the exponentiation mod(Modulus) is trivial with Java 1.1. classes.
- Mitch
> >> I had assumed this was a symmetric cipher. It didn't occur to me that
> >>the OP could be trying to use public key crypto.
[quoted text clipped - 8 lines]
>
> --Mike Amling
Michael Amling - 02 May 2004 22:01 GMT
> The most common padding PKCS #1.5 is pretty easy to implement (for either
> signature blocks, where padding is nulls, or encyrption blocks where padding is random).
> Then the exponentiation mod(Modulus) is trivial with Java 1.1. classes.
> - Mitch
Those padding schemes have not been proved secure. To quote from the
original OAEP paper, available at
http://www.cs.ucdavis.edu/~rogaway/papers/oaep-abstract.html,
whether or not [PKCS#1 and an IBM scheme] "work" depends on aspects of f
beyond its being one-way,
<<
where f is the RSA transform c=m**e.
By comparison, OAEP has been proven to be secure if RSA is secure.
See http://eprint.iacr.org/2000/061/, for the latest on it.
Note: I'm using the term "secure" rather loosely. The papers have
precise definitions.
--Mike Amling
Michael Amling - 02 May 2004 22:03 GMT
>> The most common padding PKCS #1.5 is pretty easy to implement (for either
>> signature blocks, where padding is nulls, or encyrption blocks where
[quoted text clipped - 10 lines]
> <<
> where f is the RSA transform c=m**e.
Should be c=m**e mod n
> By comparison, OAEP has been proven to be secure if RSA is secure. See
> http://eprint.iacr.org/2000/061/, for the latest on it.
[quoted text clipped - 3 lines]
>
> --Mike Amling

Signature
--Mike Amling
Roedy Green - 30 Apr 2004 18:48 GMT
> If it's RSA, don't forget the padding. OAEP, PSS SAEP+ are hard to
>implement with just BigInteger.
Here's the trick I used.
/* first byte ensures lead 0s are not lost
when the message considered as a number.
It must be a positive random number between 1 and 127 */
byte lead = (byte)(wheel.nextInt(127) + 1);
message[0] = lead;
I discard this byte on decrypt.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.