Implementing RSA encryption using JDK1.1.3

Hiroyuki Eguchi (HIROEGU@jp.ibm.com)
Tue, 5 Aug 1997 10:26:49 +0900

From: "Hiroyuki Eguchi"<HIROEGU@jp.ibm.com>
To: java-security@web2.javasoft.com
Date: Tue, 5 Aug 1997 10:26:49 +0900
Subject: Implementing RSA encryption using JDK1.1.3

Hello,
I have started implementing my own provider for RSA encryption and
signatures ( as there will be no international release of JCE) and I am
having some difficulties. I am trying to implement a method for RSA
encryption using the PKCS#1 standards. The problem is that the formula
used in PKCS#1 considers a byte of data to be able to take the value of
0-255. Unfortunately, the byte data type provided in Java can take values
between -128 and 127 only. I have been considering ways of working around
this problem, as recpmputing the PKCS#1 formulae to work with the byte data
type in Java, or map the -ve values of the data to the one it should be,
had the byte data type had a range of 0-255 (for eg. -1 will map to 255).
But I am afraid that the data encrypted by my methods may not be correctly
decrypted by some other applications. ( Another alternative I have been
thinking of is to create my own "byte" class, but that might be very
tedious, which is why I would like to leave it as my last resort. ). I
would be very grateful to you if you could advise me on how to solve this
problem. I have looked at the "java.security.Cipher" specifications, and
all your encryption/decryption methods take a byte array as input and
output a byte array. So, I guess there must be a way to work around this
problem.
I was also wondering what padding scheme is the JCE using for RSA
encryption/decryption. The only RSA encryption standard that I am aware of
is the PKCS#1. I guess there must be others, unfortunately I have not been
able to find any yet. I would be very grateful if you could help me there
as well.
Thanking you in anticipation.
Kind Regards.

Hiroyuki Eguchi
Manager of Special Projects, Platform Development
E-mail: hiroegu@jp.ibm.com @internet
TEL: 0462-73-3023 (81-462-73-3023)
FAX: 0462-73-9418 (81-462-73-9418)