Verifying a Signature

本文详细介绍了Alice如何创建密钥库并生成密钥对,接着导出证书文件,并将其发送给Bob。Bob收到证书后进行导入,并验证由Alice签名的文档。整个过程使用了keytool和jarsigner工具。

 

Verifying a Signature

First

Alice

alice  Creates a keystore, alice.certs, and generates a key pair with alias alice

keytool -genkeypair -keystore alice.certs -alias alice

export a certificate file:

keytool -exportcert -keystore alice.certs -alias alice -file alice.cer

Bob

When Bob receives the certificate, he can print it:

keytool -printcert -file alice.cer

he can import it into his keystore

       keytool -importcert -keystore bob.certs -alias alice -file alice.cer

Second

Now Alice can start sending signed documents to Bob. The jarsigner tool signs and verifies JAR files. Alice simply adds the document to be signed into a JAR file.

jar cvf document.jar document.txt

Then she uses the jarsigner tool to add the signature to the file. She needs to specify the keystore, the JAR file, and the alias of the key to use

       jarsigner -keystore alice.certs document.jar alice

When Bob receives the file, he uses the -verify option of the jarsigner program

       jarsigner -verify -keystore bob.certs document.jar

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值