|
|
Generating and Verifying Signatures |
Here's the basic structure of the
GenSigprogram created by this lesson. Place it in a file calledGenSig.java:import java.io.*; import java.security.*; class GenSig { public static void main(String[] args) { /* Generate a DSA signature */ if (args.length != 1) { System.out.println("Usage: GenSig nameOfFileToSign"); } else try { // the rest of the code goes here } catch (Exception e) { System.err.println("Caught exception " + e.toString()); } } }
Notes:
- The methods for signing data are in the
java.securitypackage, so the program imports everything from that package. It also imports thejava.iopackage since that package contains the methods needed to input the file data to be signed.
- A single argument is expected, specifying the data file to be signed.
- The code written in subsequent steps of this lesson will go between the
tryandcatchblocks.
|
|
Generating and Verifying Signatures |