Q

Java programming resources

Find Java-specific resources here.

I am a Java programmer. I have successfully done some secret key encryption and decryption. I can use the private key to sign a message and verify with the public key, but I still need some coding examples on how to encrypt with the public key and decrypt with the private key or vice versa. Can you recommend any resources on this topic?
I find the best place to go for Java code examples is the Sun Developer Network (SDN) run by Sun Microsystems, the developers of Java technology. SDN has two articles, which include the types of example you are after. The first is Cryptography: The Ancient Art of Secret Messages at http://java.sun.com/developer/technicalArticles/Security/Crypto/. The second is Java 2 Cryptography Extension: Encrypting and Decrypting Data at http://java.sun.com/developer/technicalArticles/Security/JCE/. This second article examines the classes in the JCE javax.crypto package and, in particular, the classes that are central to data encryption and decryption, the Cipher and KeyGenerator. They also provide pseudo code segments for an encryption and decryption program. An encryption program uses a secret key to encrypt a text string and a sealed object to wrap the secret key with the recipient's public key. A decryption program receives the encrypted text and wrapped session key over the network, then unwraps the secret key by using its private key and uses the recovered secret key to decrypt the message.

Two other articles that cover code examples are Using RSA encryption with Java by Aviran Mordo at http://www.aviransplace.com/index.php/archives/2004/10/12/using-rsa-encryption-with-java/2/

and Public Key Cryptography 101 Using Java by Richard G. Baldwin: http://www.developer.com/java/ent/article.php/3447491

Finally, if you don't already have it, I suggest looking into the Java Cryptography Extension (JCE)Reference Guide for the Java 2 SDK, Standard Edition, v 1.4 is available at http://java.sun.com/j2se/1.4.2/docs/guide/security/jce/JCERefGuide.html

This was first published in December 2005

Dig deeper on Software Development Methodology

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchCloudSecurity

SearchNetworking

SearchCIO

SearchConsumerization

SearchEnterpriseDesktop

SearchCloudComputing

ComputerWeekly

Close