JCA/JCE API Tutorial

This appendix will introduce the reader to the Java API known as the Java Cryptography Extension (JCE) through development of a simple application.

It is important to note that this tutorial does not provide complete coverage of this API. The API specification documentation should serve as the detailed reference. It can be found here: http://docs.oracle.com/

During this tutorial we will develop a JCE-based application that allows for simple file encryption. This application will allow the user to encrypt and decrypt files.

The files are encrypted using a combination of public-key and secret-key cryptography. The encrypted files also include a Message Authentication Code (MAC) to ensure the integrity of their contents. Where possible, the standard API mechanisms will be used to achieve the desired functionality.

The code fragments included in this document are used to highlight the important sections of the application. The full source code for the application may be found in the Java source file FileCrypt.java.

This document contains the following chapters:

>Public Key Cryptography

>FileCrypt Application

File Encryption

File Decryption

Accessing Public Keys

Main()