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 27-1. The javax.crypto.interfaces package
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.
Implementations: DHPrivateKey, DHPublicKey
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.
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.
Copyright © 2001 O'Reilly & Associates. All rights reserved.