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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
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.

Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

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?
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.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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:

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.