**Cryptography Tutorials - Herong's Tutorial Examples** - Version 5.40, by Dr. Herong Yang

DES Java Implementation in JDK by Sun

This section describes how DES algorithm is implemented in JDK. DES algorithm is implemented as part of the JCE package which is integrated in the JDK since version 1.4.

DES algorithm has been implemented in Java by Sun as part of the JDK JCE (Java Cryptography Extension) package. JCE was previously an optional package (extension) to the Java 2 SDK, Standard Edition, versions 1.2.x and 1.3.x. JCE has now been integrated into the Java 2 SDK, version 1.4.x, and new versions.

Sun's implementation of DES includes the following features:

- Offers both DES and Triple DES algorithms.
- Offers Electronic Code Book (ECB), Cipher Block Chaining (CBC), Cipher Feedback (CFB), Output Feedback (OFB), and Propagating Cipher Block Chaining (PCBC) modes.
- Offers PKCS5 padding options

The following JCE classes and interfaces are involved to support DES encryption and decryption:

- javax.crypto.spec.DESKeySpec - This class specifies a DES encryption and decryption key material.
- javax.crypto.spec.DESedeKeySpec - This class specifies a DES-EDE ("triple-DES") encryption and decryption key material.
- javax.crypto.SecretKeyFactory - This class represents a factory for secret keys. SecretKeyFactory allows you to build an opaque secret key object from a given key specification (key material), like a DESKeySpec object. It also allows you to retrieve the underlying key material of an opaque secret key object.
- javax.crypto.Cipher - This class provides the functionality of a cryptographic cipher for encryption and decryption. In order to create a Cipher object, the application calls the Cipher's getInstance() method, and passes the name of the requested transformation of a specific cryptographic algorithm (e.g. DES) to it.

Table of Contents

Introduction to AES (Advanced Encryption Standard)

DES Algorithm - Illustrated with Java Programs

DES Algorithm Java Implementation

►DES Algorithm - Java Implementation in JDK JCE

►DES Java Implementation in JDK by Sun

Steps of Using DES Algorithm in JDK JCE

Testing DES Algorithm in JDK JCE

JceSunDesPaddingTest.java - JCE DES Padding Test

DES Encryption Operation Modes

PHP Implementation of DES - mcrypt

Blowfish - 8-Byte Block Cipher

Secret Key Generation and Management

Cipher - Secret Key Encryption and Decryption

RSA Implementation using java.math.BigInteger Class

Introduction of DSA (Digital Signature Algorithm)

Java Default Implementation of DSA

Private key and Public Key Pair Generation

PKCS#8/X.509 Private/Public Encoding Standards

Cipher - Public Key Encryption and Decryption

OpenSSL Introduction and Installation

OpenSSL Generating and Managing RSA Keys

OpenSSL Generating and Signing CSR

OpenSSL Validating Certificate Path

"keytool" and "keystore" from JDK

"OpenSSL" Signing CSR Generated by "keytool"

Migrating Keys from "keystore" to "OpenSSL" Key Files

Certificate X.509 Standard and DER/PEM Formats

Migrating Keys from "OpenSSL" Key Files to "keystore"