JDK Tutorials - Herong's Tutorial Examples - Version 6.02, by Dr. Herong Yang
java.security.Signature - The Data Signing Class
This section describes the data signing class, java.security.Signature, and its major methods like update() and sign().
The java.security.Signature class is an abstract class providing a link to implementation classes of digital signature algorithms provided by various security package providers. Major methods in the KeyPairGenerator class:
getInstance() - Returns a Signature object of the specified algorithm from the implementation of the specified provider. If provider is not specified, the default implementation is used. This is a static method.
initSign() - Initializes the current Signature object with the specified private key to be ready to take input data for generating a new signature.
initVerify() - Initializes the current Signature object with the specified public key to be ready to take input data for verifying an existing signature.
update() - Adds more data to the current Signature object for signature generation or signature verification.
sign() - Generates a new signature for the input data received so far in the current Signature object, and returns the signature as a byte array. It also removes the input data.
verify() - Verifies the input data received so far in the current Signature object against the specified signature, and returns true or false. It also removes the input data.
getAlgorithm() - Returns the algorithm name of the current Signature object.
getProvider() - Returns the provider as a Provider object of the current Signature object.
See the next section on how to write a sample program.
Last update: 2014.
Table of Contents
Downloading and Installing JDK 1.8.0 on Windows
Downloading and Installing JDK 1.7.0 on Windows
Downloading and Installing JDK 1.6.2 on Windows
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
PKCS#8/X.509 Private/Public Encoding Standards
►Digital Signature Algorithm and Sample Program
The Signing Process and the Verification Process
►java.security.Signature - The Data Signing Class
JcaSignatureTest.java - Signature Test Program
JcaSign.java - Signature Generation Sample Program
JcaVerify.java - Signature Verification Sample Program
"keytool" Commands and "keystore" Files
KeyStore and Certificate Classes
Secret Key Generation and Management
Cipher - Secret Key Encryption and Decryption
The SSL (Secure Socket Layer) Protocol
SSL Socket Communication Testing Programs