简体   繁体   English

如何将VeriSign证书与Oracle的jarsigner一起使用来签名jar?

[英]How to use VeriSign certificate with Oracle's jarsigner to sign jars?

I already have a VeriSign certificate to sign EXEs. 我已经有一个VeriSign证书来签名EXE。 I need to reuse it to sign jars. 我需要重用它来签名罐子。

Is it possible to reuse that certificate to sign jars? 是否可以重复使用该证书来签名罐子?

Can someone explain me, how to use this VeriSign certificate with Oracle's jarsigner to sign jar files? 有人可以向我解释一下,如何将此VeriSign证书与Oracle的jarsigner一起使用来签名jar文件吗?

Any help is appreciated. 任何帮助表示赞赏。

Steps I followed: 我遵循的步骤:

Step 1. Create key store keytool -genkey -keyalg rsa -keystore MYStore.ks -alias mySelf -keysize 2048 步骤1.创建密钥库keytool -genkey -keyalg rsa -keystore MYStore.ks -alias mySelf -keysize 2048

keystore pw : 4804994 mySelf pw: abcdef 密钥库密码:4804994 mySelf密码:abcdef

Step 2. Import Verisign certificate to key store 步骤2.将Verisign证书导入密钥库

keytool -importcert -file MSCV-VSClass3.cer -keystore MYStore.ks keytool -importcert-文件MSCV-VSClass3.cer -keystore MYStore.ks

This displays certificate info and ask; 显示证书信息并询问; Trust this certificate ? 信任此证书吗? [no] : yes [否]:是的

Certificate was added to keystore. 证书已添加到密钥库。

Step 3. jarsigner -keystore MYStore.ks TestRun.jar mySelf 步骤3. jarsigner -keystore MYStore.ks TestRun.jar mySelf

Warning: signer certificate will expire within six months. 警告:签署者证书将在六个月内到期。

Now I wanted to verify the signed jar. 现在,我想验证签名的罐子。

jarsigner -verify -verbose -certs TestRun.jar jarsigner -verify -verbose -certs TestRun.jar

Warning: This jar contain entries whose signer certificate will expire within six months. 警告:此jar包含其签名者证书将在六个月内到期的条目。 This jar contain entries whose certificate chain is not validated. 此jar包含其证书链未经验证的条目。

As I understand, key store does not have the private key of the public key in the certificate. 据我了解,密钥存储区在证书中没有公钥的私钥。

How to solve this issue? 如何解决这个问题?

Cheers. 干杯。

You can just start signing with the PFX file as this can be seen as a keystore file. 您可以开始使用PFX文件签名,因为这可以看作是密钥库文件。 The command you can try and use would be something like 您可以尝试使用的命令类似于

jarsigner -storetype pkcs12 -keystore cert2013.pfx something.jar "1" -tsa http://verisignstimestampurl.something.com

Or you can import the PKCS12 file into to a JKS file but that seems a bit pointless; 或者,您可以将PKCS12文件导入到JKS文件中,但这似乎没有意义。

keytool -importkeystore -srckeystore cert2013.pfx -srcstoretype PKCS12 -deststoretype JKS -destkeystore keystore.jks

Hope any of the two commands above help. 希望以上两个命令中的任何一个对您有所帮助。 The first command you will have to find out what VeriSigns timestamp URL is, and the "1" was also a guess, you can view the alias assigned to it by typing; 第一条命令将必须找出什么是VeriSigns时间戳URL,并且“ 1”也是一个猜测,您可以通过键入以下内容查看分配给它的别名:

keytool -list -keystore cert2013.pfx -storetype PKCS12

Regards, 问候,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM