Java程序来验证signtool签名的数字签名 [英] Java program to verify digital signature signed by signtool
问题描述
我已经使用SignTool对文件(.exe或.dll不是jar文件)进行了数字签名. Signtool还可以验证数字签名. 但是我的要求是使用java程序检查signtool签名的文件的数字签名.
I have digitally signed a file(either .exe or .dll not a jar file) using SignTool. Signtool can also verify the digital signature. But my requirement is to check digital signature of file signed by signtool using java program.
我在互联网上进行搜索,但未找到任何信息. 您能给我有关这方面的指点吗?
I searched on internet but didn't find any info. Could you please give me pointers regarding the same?
感谢您的建议.
推荐答案
签名代码
jarsigner -keystore c:/my.keystore -storepass ozziepassword e:/securityApplet.jar ozzie
jarsigner -keystore c:/my.keystore -storepass ozziepassword e:/securityApplet.jar ozzie
验证码:
jarsigner -verify e:/securityApplet.jar
jarsigner -verify e:/securityApplet.jar
要验证签名:
To verify signature:
Signature signer = null;
try {
signer = Signature.getInstance("SHA1withRSA");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return "Verify : No Such Algorith Exception." + e.getMessage();
}
try {
result = signer.verify(digitalSignature);
} catch (SignatureException e) {
e.printStackTrace();
return "Verify : Signature Exception." + e.getMessage();
}
这篇关于Java程序来验证signtool签名的数字签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!