Jarsigner在删除jre/lib/ext后出现问题

5
根据这篇文章:https://blogs.oracle.com/java-platform-group/planning-safe-removal-of-under-used-endorsed-extension-directories,Java 9中移除了jre/lib/ext。
我的问题是,我正在使用Jarsigner,在之前的Java版本中,它会在jre/lib/ext文件夹中找到我的提供者jar。请问该如何解决?
jarsigner -tsa timestamp.digicert.com -verbose -keystore NONE -storetype PKCS11 
      -storepass null -providername <MY_PROVIDER_NAME> <JAR_FILE> <CERTIFICATE_NAME> 

我该如何解决这个问题?

<JAR_FILE>不足以指定要签署的jar,移除 jre/lib/ext 会对此有什么影响? - Naman
<JAR_FILE> 是要签名的 JAR 文件。在 jre/lib/ext 中,我放置了我的 Java 安全提供程序 JAR。 - Saar peer
2个回答

1
我终于成功解决了这个问题,基于 https://docs.oracle.com/javase/9/security/howtoimplaprovider.htm#JSSEC-GUID-7C304A79-6D0B-438B-A02E-51648C909876
需要执行以下步骤(只针对Java 9):
按照第4步添加模块声明。
module com.foo.MyProvider {
    provides java.security.Provider with p.MyProvider;
    requires java.security.jgss;
}

当使用模块路径运行Jarsigner时:
jarsigner -J--module-path -J<PATH_TO_PROVIDER_JAR> -J--add-modules -J<MODULE_NAME>
-tsa timestamp.digicert.com -verbose -keystore NONE -storetype PKCS11 -storepass null -providername <MY_PROVIDER_NAME> <JAR_FILE> <CERTIFICATE_NAME> 

1
安装JDK/JRE镜像的更改会带来运行时镜像,其中包括以下目录-

conf — 包含.properties、.policy和其他类型的文件,旨在供开发人员、部署者和最终用户编辑。这些文件以前可以在lib目录或其子目录中找到。


JDK9中java.security文件(位于.../Home/conf/security下)将SunPKCS11提供程序列在默认提供程序列表中。

security.provider.13=SunPKCS11

#SunPKCS11 配置在参考指南中详细说明了如何添加JDK的jdk.crypto.cryptoki模块中存在的提供程序。

因此,在Java9中理想情况下不需要配置路径到sunpkcs11提供程序。


为了举例说明如何将提供程序捆绑到模块中,请参阅JEP 220:模块化运行时映像

Security-policy files and other uses of the CodeSource API can use jrt URLs to name specific modules for the purpose of granting permissions. The elliptic-curve cryptography provider, e.g., can now be identified by the jrt URL

jrt:/jdk.crypto.ec 

Other modules that are currently granted all permissions but do not actually require them can trivially be de-privileged, i.e., given precisely the permissions they require.


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接