Symmetric Encryption
In Chapter 3 we introduced symmetric encryption, and in this chapter we're going to elaborate on the
subject by describing how to use the JCE to perform symmetric encryption. To begin with, we will look at
how we encrypt and decrypt using symmetric encryption. Then we discuss applications for symmetric
encryption, followed by some examples, which deal with the following aspects of encryption:
q
Basic encryption
q
Encryption using Blowfish
q
Password-based encryption
The main topics discussed in this chapter are:
q
Key storage, including wrapping and unwrapping
q
Modes
q
Cipher streams and how to initialize ciphers with an initialization vector
q
Sealed objects
Remember, before trying to run any of the code in the chapter you'll need an encryption engine
installed. Here we'll be using the Bouncy Castle provider because it has support for many
algorithms, and won't restrict us from using any other providers in the future (instructions for its
installation are provided in the previous chapter).