Book Home Java Enterprise in a Nutshell Search this book

Chapter 27. The javax.crypto.interfaces Package

The interfaces in the javax.crypto.interfaces package define the methods that must be supported by the Diffie-Hellman public/private key pairs used in the Diffie-Hellman key-agreement protocol. These interfaces are typically of interest only to programmers who are implementing a cryptographic provider or who want to implement cryptographic algorithms themselves. Use of this package requires basic familiarity with the Diffie-Hellman key-agreement algorithm and the mathematics that underlie it. Figure 27-1 shows the class hierarchy of this package. Note that the javax.crypto.spec package also contains classes that provide algorithm-specific details about Diffie-Hellman keys.

figure

Figure 27-1. The javax.crypto.interfaces package

DHKeyJCE 1.2
javax.crypto.interfaces

This interface represents a Diffie-Hellman key. The javax.crypto.spec.DHParameterSpec returned by getParams() specifies the parameters that generate the key; they define a key family. See the subinterfaces DHPublicKey and DHPrivateKey for the actual key values.

public abstract interface DHKey {
// Public Instance Methods
public abstract javax.crypto.spec.DHParameterSpec getParams ();
}

Implementations: DHPrivateKey, DHPublicKey

DHPrivateKeyJCE 1.2
javax.crypto.interfacesserializable

This interface represents a Diffie-Hellman private key. Note that it extends two interfaces: DHKey and java.security.PrivateKey. getX() returns the private-key value. If you are working with a PrivateKey you know is a Diffie-Hellman key, you can cast your PrivateKey to a DHPrivateKey.

public abstract interface DHPrivateKey extends DHKey, java.security.PrivateKey {
// Public Instance Methods
public abstract java.math.BigInteger getX ();
}

Hierarchy: (DHPrivateKey(DHKey,java.security.PrivateKey(java.security.Key(Serializable))))

DHPublicKeyJCE 1.2
javax.crypto.interfacesserializable

This interface represents a Diffie-Hellman public key. Note that it extends two interfaces: DHKey and java.security.PublicKey. getY() returns the public-key value. If you are working with a PublicKey you know is a Diffie-Hellman key, you can cast your PublicKey to a DHPublicKey.

public abstract interface DHPublicKey extends DHKey, java.security.PublicKey {
// Public Instance Methods
public abstract java.math.BigInteger getY ();
}

Hierarchy: (DHPublicKey(DHKey,java.security.PublicKey(java.security.Key(Serializable))))



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.

This HTML Help has been published using the chm2web software.