JDK Tutorials - Herong's Tutorial Examples - v6.32, by Herong Yang
Private and Public Keys and Related Interfaces
This section describes private and public key pairs used in RSA and DSA encryption algorithms. JDK supports private and public keys with the java.security.Key interface.
What a private and public key pair? A private and public key pair is a private key and a public key used in a public key encryption algorithm.
Known private and public key pair generation algorithms are:
JDK supports private and pubic key pairs with 3 interfaces.
1. java.security.Key is the interface acting as a base to support common features of both private key and public key. Major methods include:
getAlgorithm() - Returns the algorithm name used to generate the key.
getEncoded() - Returns the key as a byte array in its primary encoding format, or null if this key does not support encoding.
getFormat() - Returns the name of the primary encoding format of this key, or null if this key does not support encoding.
2. java.security.PrivateKey is the interface representing a private key. It extends java.security.Key interface with no additional methods.
3. java.security.PublicKey is the interface representing a public key. It extends java.security.Key interface with no additional methods.
Table of Contents
Date, Time and Calendar Classes
Date and Time Object and String Conversion
Number Object and Numeric String Conversion
Locales, Localization Methods and Resource Bundles
Calling and Importing Classes Defined in Unnamed Packages
HashSet, Vector, HashMap and Collection Classes
Character Set Encoding Classes and Methods
Encoding Conversion Programs for Encoded Text Files
Datagram Network Communication
DOM (Document Object Model) - API for XML Files
DTD (Document Type Definition) - XML Validation
XSD (XML Schema Definition) - XML Validation
XSL (Extensible Stylesheet Language)
Message Digest Algorithm Implementations in JDK
►Private key and Public Key Pair Generation
►Private and Public Keys and Related Interfaces
KeyPair and KeyPairGenerator Classes
Key Pair Sample Program - JcaKeyPair.java
DSA Private Key and Public Key Pair Sample
RSA Private Key and Public Key Pair Sample
DiffieHellman Private Key and Public Key Pair Sample
PKCS#8/X.509 Private/Public Encoding Standards
Digital Signature Algorithm and Sample Program
"keytool" Commands and "keystore" Files
KeyStore and Certificate Classes
Secret Key Generation and Management
Cipher - Encryption and Decryption
The SSL (Secure Socket Layer) Protocol
SSL Socket Communication Testing Programs