|
|
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
To start the creation of our example application:
- Create a text file named
testSig.java.
- Add
importstatements.The methods for signing data are in the
java.securitypackage, so we import everything from that package. We also need to import thejava.iopackage since it contains the methods we need to input the file data to be signed.import java.io.*; import java.security.*;- Start the class definition:
class testSig {- Type the signature for the
mainmethod (which we need, since this is an application), and write a comment about what this program does:public static void main(String[] args) { /* Test generating and verifying a DSA signature */- Write the exception-handling blocks.
These are needed because many methods called by the program throw exceptions that we must catch. Note: The code we write in subsequent steps of this lesson to generate and verify a signature will go between the
tryandcatchblocks.try { } catch (Exception e) { System.err.println("Caught exception " + e.toString()); }- Write the closing braces for the main method and the testSig class:
} }What We've Got So Far
Now we've got the basic structure of our program. It looks like this:
import java.io.*; import java.security.*; class testSig { public static void main(String[] args) { /* Test generating and verifying a DSA signature */ try { } catch (Exception e) { System.err.println("Caught exception " + e.toString()); } } }
|
|
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2004 Sun Microsystems, Inc. All rights reserved.