A browser with JavaScript enabled is required for this page to operate properly.
Documentation

The Java™ Tutorials
Trail: Security Features in Java SE
Lesson: Generating and Verifying Signatures
Section: Verifying a Digital Signature
« PreviousTrailNext »

The Java Tutorials have been written for JDK 8. Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.
See Dev.java for updated tutorials taking advantage of the latest releases.
See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.

Compile and Run the Program

Here is the complete source code for the VerSig.java program, with some comments added.

Compile and run the program. Remember, you need to specify three arguments on the command line:

  • The name of the file containing the encoded public key bytes
  • The name of the file containing the signature bytes
  • The name of the data file (the one for which the signature was generated)

Since you will be testing the output of the GenSig program, the file names you should use are

  • suepk
  • sig
  • data

Here's a sample run; the bold indicates what you type.

%java VerSig suepk sig data
signature verifies: true
« PreviousTrailNext »

Previous page: Verify the Signature
Next page: Weaknesses and Alternatives

AltStyle によって変換されたページ (->オリジナル) /