Java program to verify digital signature signed by signtool

三世轮回 提交于 2020-01-15 08:06:10

问题


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?

Thanks for your suggestion.


回答1:


Signing Code

jarsigner -keystore c:/my.keystore -storepass ozziepassword e:/securityApplet.jar ozzie

Verify Code:

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();

    }


来源:https://stackoverflow.com/questions/24915753/java-program-to-verify-digital-signature-signed-by-signtool

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!