Write a DES program

As I know, JDK1.2.2 doesn't provide any API to implement Data Encryption Standard(DES) directly.
How to write a DES program using the currently existing API like security or security.cert? Do these packages can be used to generate the 16 subkeys for DES? Is there any reference?

Who is Participating?
JodConnect With a Mentor Commented:
The security API is for dealing with certificates and the following:

"Provides interfaces for generating RSA (Rivest, Shamir and Adleman AsymmetricCipher algorithm) keys as defined in the RSA Laboratory Technical Note PKCS#1, and DSA (Digital Signature Algorithm) keys as defined in NIST's FIPS-186"

The JCE will have more stuff for dealing with cryptography (link as above) but it has no source code available.

Whatever you decide to do, still download the Acme package from the above address as it provides a full implementation and gives you ALL the source code neccessary for you to figure out how it works.

Use it as is or as a starting point to get you going but definately do use it.

The basic answer is you don't have to write one. you can use the Acme.crypto package to do DES, Triple DES, etc...

You will find it here:


Look down to the bit on Acme.crypto
you can also port C code to java, it is not difficult.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

You might also want to look at Sun's page for their JCE package.

There is also the O'Reilly book
Java Cryptography, which has some nice examples.

It really takes most of the work out of writing crypto code. What pretty much happens is you get a key object, have it generate a key for you, then encrypt with that key. All hidden in clean objects.

yueyunAuthor Commented:
If i like to write my own DES program, do the security API provide any related class which can make my work easier?
By the way, if you wish to get even more of a head start, one of our friends here (mbormann) has written an example program using the ACME package that shows how to build an encrypted data stream.

Example is here:

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.