demo
Class RSA

java.lang.Object
  |
  +--demo.RSA

public class RSA
extends Object

This class tests the RSA cipher implementation.

IAIK-JCE allows to use the javax.crypto.Cipher class for working with RSA ciphers. Creating a RSA cipher is done in the same way as creating a, for instance, DES or IDEA cipher by calling a proper getInstance factory method, e.g.:

Cipher rsa = Cipher.getInstance("RSA");

The supplied transformation string may be expanded to perform block formatting according to PKCS#1 with block type 1 or blocktype 2, i.e.:

 Cipher rsa = Cipher.getInstance("RSA/ECB/PKCS1Padding");
 

The further proceeding uses cipher initialization, cipher update and cipher finishing as used with any other cipher, e.g.:

 rsa.init(Cipher.ENCRYPT_MODE, public_key);
 byte[] encrypted = rsa.doFinal(plain_data);
 


Constructor Summary
RSA()
           
 
Method Summary
static void main(String[] argv)
          Starts the RSA cipher implementation test.
 void start()
          Performs the RSA cipher implementation test.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSA

public RSA()
Method Detail

start

public void start()
Performs the RSA cipher implementation test.

First a RSA key pair for 512 bit modulus is generated, which may last a few moments. Subsequently, a RSA cipher object is created for encrypting some test data. For verifying the result of the encryption process, it is decrypted again and compared with the original data.

Returns:
true if no errors occurs during en/decryption, false otherwise

main

public static void main(String[] argv)
Starts the RSA cipher implementation test.

This Javadoc may contain text parts from IETF Internet Standard specifications, see copyright note) and RSA Data Security Public-Key Cryptography Standards (see copyright note).

IAIK-JCE ME 3.04, (c) 2002 IAIK, (c) 2003 to 2006 Stiftung SIC