问题描述
我写了一个自定义PKCS11提供程序,现在我想通过jarsigner来使用它.
I wrote a custom PKCS11 provider and now i want to user it via jarsigner.
我的命令:
jarsigner -verbose -keystore NONE -storetype PKCS11 -providerClass my.provider.class jar_to_sign_on.jar "key_name"
我得到以下错误:
jarsigner error: java.lang.ClassNotFoundException: my.provider.class
这是因为jarsinger找不到我的提供程序.jar实现.
This is because jarsinger can't find my provider .jar implementation.
当我将mt .jar放入... \ Java \ jdk1.8.0_31 \ jre \ lib \ ext时,它可以完美运行.
When i put mt .jar in ...\Java\jdk1.8.0_31\jre\lib\ext it works perfectly.
我的问题是:有一种动态设置我的提供程序.jar的方法吗? (就像keytool中的-providerPath一样)
My question is : There is a way to dynamically set my provider .jar ? (Like -providerPath in keytool)
推荐答案
jarsigner
具有-J
选项,该选项允许将其值直接传递给支持的Java进程.问题在于它不允许使用空格,因此您需要两个这样的选项来传递类路径.这样的事情应该起作用:
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
这篇关于将自定义PKCS11提供程序与jarsigner一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!