A Simple Digital Signature Algorithm

The Java Development Kit includes routines for creating and verifying digital signatures, but you might get a better feel for how they work by seeing a program that creates a signature and then verifies it. Listing 34.1 shows a digital signature demo that uses the RSA encryption algorithm introduced in Chapter 33, "Encrypting Data," to encrypt a message digest. It then decrypts the digest and compares the decrypted digest with the original, which is the signature-verification process.

Code Listing 34.1. Source Code for SignatureDemo.java
 package usingj2ee.security; import java.security.*; import java.security.interfaces.*; import java.math.*; public class SignatureDemo { public static void main(String[] args) ...

Get Special Edition Using Java™ 2 Enterprise 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.