O'Reilly logo

Java Security by Scott Oaks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Key Types in the JCE

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 javax.crypto.interfaces package of the JCE as new interfaces:

public interface DHKey, public interface DHPrivateKey extends DHKey, PrivateKey, public interface DHPublicKey extends DHKey, PublicKe y

This set of interfaces defines keys suitable for use in Diffie-Hellman algorithms. In the SunJCE provider, they are used for the key agreement engine.

Like their DSA-based counterparts (the DSAKey, DSAPublicKey, and 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.

Secret Keys

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required