Name

KeyPair

Synopsis

This class is a simple container for a PublicKey and a PrivateKey object. Because a KeyPair contains an unprotected private key, it must be used with as much caution as a PrivateKey object.

java.security.KeyPair

Figure 14-20. java.security.KeyPair

public final class KeyPair implements Serializable {
// Public Constructors
     public KeyPair(PublicKey publicKey, PrivateKey privateKey);  
// Public Instance Methods
     public PrivateKey getPrivate( );  
     public PublicKey getPublic( );  
}

Passed To

Signer.setKeyPair( )

Returned By

KeyPairGenerator.{generateKeyPair( ), genKeyPair( )}, KeyPairGeneratorSpi.generateKeyPair( )

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.