Jar包签名

1、生成keystore及key

#生成私钥
keytool -validity 10000 -genkey -alias xxxxxx -keypass xxxxxx -storepass xxxxxx -keystore xxxxxx.jks -dname "CN=(R&D),O=(ATS),C=(CN)" -keyalg RSA

导出证书

#证书DER格式
keytool -exportcert -alias xxxxxx -keypass xxxxxx -keystore xxxxxx.jks -storepass xxxxxx -file xxxxxx.der
#证书PEM格式
keytool -exportcert -alias xxxxxx -keypass xxxxxx -keystore xxxxxx.jks -storepass xxxxxx -rfc -file xxxxxx.pem

枚举证书

keytool -list -keystore xxxxxx.jks 

2、签名

jarsigner -keystore xxxxxx.jks -storepass xxxxxx -keypass xxxxxx xxxxxx.jar xxxxxx

3、验证

JARsigner -verbose -verify  xxxxxx.jar

Leave a Reply

Your email address will not be published. Required fields are marked *

*