The JCE introduces many new types of keys. Some of these are new types of public and private keys that extend our previous exploration of keys, and some of these are a new type of key: a secret key.
The new public and private key types are defined in the
package of the JCE as new interfaces:
This set of interfaces defines keys suitable for use in
Diffie-Hellman algorithms. In the
provider, they are used for the key agreement engine.
Like their DSA-based counterparts (the
DSAPrivateKey classes), these interfaces all
have specific methods to retrieve the values of certain parameters of
the key. Since they are all keys, they support a byte-encoded format
as well. For our purposes, however, we’ll treat their data as
opaque objects. The Diffie-Hellman keys are used in the key agreement
protocol we discuss later in this chapter.
The new type of key in the JCE is a secret key. A secret key is a key that is shared between two parties in a cryptographic operation.
Until now, we’ve used public key/private key pairs for all our operations. For instance, the digital signature algorithms we explored in Chapter 12 all depended on public key cryptography to alter the message digest of the data they signed. These algorithms chose to use public key encryption because ...