Download the JDK
Search the Tutorials
Hide the TOC
Trail: Security Features in Java SE
Lesson: Generating and Verifying Signatures
Section: Verifying a Digital Signature
Generating and Verifying Signatures
Generating a Digital Signature
Prepare Initial Program Structure
Generate Public and Private Keys
Sign the Data
Save the Signature and the Public Key in Files
Compile and Run the Program
Verifying a Digital Signature
Prepare Initial Program Structure
Input and Convert the Encoded Public Key Bytes
Input the Signature Bytes
Verify the Signature
Compile and Run the Program
Weaknesses and Alternatives
Home Page > Security Features in Java SE > Generating and Verifying Signatures
« Previous • Trail • Next »
Input the Signature Bytes

> Next, input the signature bytes from the file specified as the second command line argument.

> >             FileInputStream sigfis = new FileInputStream(args[1]);
> >             byte[] sigToVerify = new byte[sigfis.available()];
> >             sigfis.read(sigToVerify);
> >             sigfis.close();

> Now the byte array `sigToVerify` contains the signature bytes.

« Previous • Trail • Next »
Previous page: Input and Convert the Encoded Public Key Bytes
Next page: Verify the Signature