Documentation

The Java™ Tutorials
Hide TOC
Generating and Verifying Signatures生成和验证签名
Trail: Security Features in Java SE

Lesson: Generating and Verifying Signatures课程:生成和验证签名

This lesson walks you through the steps necessary to use the JDK Security API to generate a digital signature for data and to verify that a signature is authentic. 本课程将指导您完成使用JDKSecurity API为数据生成数字签名并验证签名是否真实所需的步骤。This lesson is meant for developers who wish to incorporate security functionality into their programs, including cryptography services.本课程面向希望将安全功能(包括加密服务)纳入其程序的开发人员。

This lesson demonstrates the use of the JDK Security API with respect to signing documents. The lesson shows what one program, executed by the person who has the original document, would do to generate keys, generate a digital signature for the document using the private key, and export the public key and the signature to files.本课程演示了JDKSecurity API在签署文档方面的使用。本课程展示了由拥有原始文档的人执行的程序将如何生成密钥,使用私钥为文档生成数字签名,并将公钥和签名导出到文件中。

Then it shows an example of another program, executed by the receiver of the document, signature, and public key. It shows how the program could import the public key and verify the authenticity of the signature. 然后,它显示了由文档、签名和公钥的接收者执行的另一个程序的示例。它展示了程序如何导入公钥并验证签名的真实性。The lesson also discusses and demonstrates possible alternative approaches and methods of supplying and importing keys, including in certificates.本课程还讨论并演示了提供和导入密钥(包括证书中的密钥)的可能替代方法和途径。

For further information about the concepts and terminology (digital signatures, certificates, keystores), see the API and Tools Use for Secure Code and File Exchanges lesson.有关概念和术语(数字签名、证书、密钥库)的更多信息,请参阅API和用于安全代码和文件交换的工具课程。

In this lesson you create two basic applications, one for the digital signature generation and the other for the verification. This is followed by a discussion and demonstration of potential enhancements. The lesson contains three sections.在本课中,您将创建两个基本应用程序,一个用于数字签名生成,另一个用于验证。接下来是对潜在增强功能的讨论和演示。本课包含三个部分。


Previous page: Previous Lesson
Next page: Generating a Digital Signature