OOP-ResearchMake It Simpler by Object Oriented Programming

JCE, Java Cryptography Extension, RSA, Digital Signature

Utility class for JCE (Java Cryptography Extension). Based on RSA, it generates a pair of private key and public key. Java objects can easily be encrypted by RSA along with the digital signature. By the simple programming interface of OOP Mercury API, a few lines of code are enough for your cryptography work. OOP Mercury API can be used with any JCE implementation.


Protect your data by OOP Mercury!

In the network programming, how to protect the data is essential issue. Sun Microsystems, Inc. provides us with Java(TM) Cryptography Extension (JCE for short) 1.2, very fascinating API for cryptography. And to make our life easier, OOP-Research developed OOP Mercury API Version 1.0. OOP Mercury Version 1.0 API consists of the utility classes for using JCE 1.2 at our hand.
In this version, a set of classes for managing RSA private-public key pair is included. For example, to encrypt the local file:


RSAManager rsa=new RSAManager();
rsa.setDefault();

// Generate private-public key pair with 1024 length.
rsa.generate("my_key",1024);

// Read the local file.
FileTarget file=new FileTarget("my_secret.txt");

// Sign and encrypt the content of the file.
file.sign(rsa,"my_key_1024_pri");
file.encrypt(rsa,"my_key_1024_pri");

// Write out the signed and encrypted object
// into the local file.
ObjectOutputStream oos=
 new ObjectOutputStream(new FileOutputStream("encrypted.txt"));
oos.writeObject(file);
oos.flush();
oos.close();

// Save the private-public key pair into the local file.
ObjectOutputStream oos=
 new ObjectOutputStream(new FileOutputStream("rsa_box"));
oos.writeObject(rsa);
oos.flush();
oos.close();

And to decrypt the encrypted file back to the original one:

// Read the local file and re-construct the
// private-public key pair generated in the
// previous step.
KeyPairBox rsa=(KeyPairBox)(Mercury.getInstance("rsa_box"));

// Read the encrypted file.
ObjectInputStream ois
 =new ObjectInputStream(new FileInputStream("encrypted.txt"));
Object obj=ois.readObject();
ois.close();

// Decrypt and verify the encrypted file.
((Sealed)obj).decrypt(rsa);
((Signed)obj).verify(rsa);

// Write out the decrypted content into the local file.
((Stored)obj).restore();

Now let's encrypt any Java object (which must implements Serializable):

// Read the local file and re-construct the
// private-public key pair generated in the
// previous step.
Mercury rsa=(Mercury)(Mercury.getInstance("rsa_box"));

// Encrypt some Serializable object
SealedObject sealed=rsa.encrypt(obj,"my_key_1024_pri");

It's easy, isn't it? For details, please read the API documentation.

Go Site Map

It's also the standalone program!

In addition to using this API within our program, we can use some of these classes as the command line program. They are:

  • com.oopreserch.mercury.RSAManager
  • com.oopreserch.mercury.RSABox
  • com.oopreserch.mercury.target.FileTarget
  • com.oopreserch.mercury.target.LargeFileTarget
For example, in the console:

// Generate the private-public key pair and store it in the
// local file.

bash-2.03$java com.oopreserch.mercury.RSAManager
 -gen my_key rsa_box 512




// Encrypt the content of the local file.

bash-2.03$java com.oopreserch.mercury.target.FileTarget
 -enc my_secret.txt rsa_box my_key_1024_pri encrypted.txt


It's useful, isn't it?

Go Site Map

Application

OOP Distributor Version2.0 uses this API for its cryptography work.

Requirement

The following APIs are required :

Many companies other than Sun also implement JCE1.2 and OOP Mercury can be configured to use any of them.
NOTE
The default security provider of following classes is "The Open JCE Project for Java" by "Australian Business Access Pty Ltd (ACN 070 045 117)":
  • com.oopreserch.mercury.RSAManager
  • com.oopreserch.mercury.RSABox
  • com.oopreserch.mercury.target.FileTarget
  • com.oopreserch.mercury.target.LargeFileTarget
And to use these classes as the command line tools, class files of "The Open JCE Project for Java" must be included in the CLASSPATH. You can download "The Open JCE Project for Java".


Go Site Map

Download or browse the API doc

  • Download OOP Mercury Version 1.0.(API doc is included.) It's FREE for non-commercial use. About commercial usage, please contact me.
  • Browse the API documentation for OOP Mercury Version 1.0


Go Site Map

Caution!
All the APIs for Servlet/JSP introduced by this web site are now included in Bento framework:
  • Simpler than JSTL or Apache Struts
  • MVC framework by HTML
  • Input validation from CGI FORM
  • Easy user authentication
  • Easy localization (L10n)
To download the APIs and source code examples, please visit the web site of Bento framework.


JBuilder 2007


General Information

For Java Development

Java and all Java-based trademarks and logos are trademarks or registered of Sun Microsystems, Inc. in the United States and other countries.


ALL CONTENTS COPYRIGHT 1997-2007, OOP-Research Corporation. All rights reserved.