Documentation

The Java™ Tutorials
Hide TOC
Compile and Run the Program编译并运行程序
Trail: Security Features in Java SE
Lesson: Generating and Verifying Signatures
Section: Generating a Digital Signature

Compile and Run the Program编译并运行程序

Here is the complete source code for the GenSig.java program, with some comments added. Compile and run it. Remember, you need to specify the name of a file to be signed, as in此处是GenSigjava程序的完整源代码,并添加了一些注释。编译并运行它。记住,您需要指定要签名的文件的名称,如

java GenSig data

You can download and use this sample file named data or any other file you like. The file will not be modified. 您可以下载并使用这个名为data的示例文件或您喜欢的任何其他文件。文件将不会被修改。It will be read so that a signature can be generated for it.它将被读取,以便为其生成签名。

After executing the program, you should see the saved suepk (public key) and sig (signature) files.执行程序后,您应该看到保存的suepk(公钥)和sig(签名)文件。


Previous page: Save the Signature and the Public Key in Files
Next page: Verifying a Digital Signature