问题
I wrote a custom PKCS11 provider and now i want to user it via jarsigner.
My command :
jarsigner -verbose -keystore NONE -storetype PKCS11 -providerClass my.provider.class jar_to_sign_on.jar "key_name"
And i get the following error :
jarsigner error: java.lang.ClassNotFoundException: my.provider.class
This is because jarsinger can't find my provider .jar implementation.
When i put mt .jar in ...\Java\jdk1.8.0_31\jre\lib\ext it works perfectly.
My question is : There is a way to dynamically set my provider .jar ? (Like -providerPath in keytool)
回答1:
jarsigner
has -J
option that allows to pass its value right to the backing java process. The problem is that it doesn't allow spaces, so you need two such options to pass a classpath. Something like this should work:
jarsigner ... -J-cp -Jmylib.jar
来源:https://stackoverflow.com/questions/38450168/using-custom-pkcs11-provider-with-jarsigner