- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试从 Windows 的“受信任的根证书颁发机构”证书存储中删除证书。可以使用 SunMSCAPI
提供程序并根据 oracle's documentation 从 java 访问此存储。人们应该能够读取和写入“个人”存储和“受信任的根证书颁发机构”。至少这是我对这句话的解释
In addition, changes are reflected immediately when making modifications to the keystore, such as KeyStore.setKeyEntry(...), KeyStore.deleteEntry(...).
但是,当尝试删除条目时,我收到 java.security.KeyStoreException:访问被拒绝。
我的代码看起来像
final KeyStore msCertStore = KeyStore.getInstance("Windows-ROOT", "SunMSCAPI");
msCertStore.load(null, null);
if (msCertStore.containsAlias(mCertificateName))
{
getLogger().info("Removing certificate with alias '{}' from store '{}'", mCertificateName,
mCertificateStore.getStoreName());
msCertStore.deleteEntry(mCertificateName);
}
我得到的是
Exception in thread "main" java.security.KeyStoreException: Access is denied.
at sun.security.mscapi.KeyStore.removeCertificate(Native Method)
at sun.security.mscapi.KeyStore.engineDeleteEntry(KeyStore.java:542)
at sun.security.mscapi.KeyStore$ROOT.engineDeleteEntry(KeyStore.java:68)
at java.security.KeyStore.deleteEntry(Unknown Source)
at my.playground.DeleteCertificateCommand.execute(DeleteCertificateInstallerCommand.java:67)
...
用于执行代码的用户帐户是本地管理员,我可以在 Windows 的 certmgr.msc GUI 中手动从存储中删除证书。但使用上面的代码是行不通的。
从个人存储中删除证书Windows-MY
有效,但似乎与访问权限有关。但我需要什么权利?
顺便说一句:操作系统是 Windows Server 2008 RC2
最佳答案
每http://www.oracle.com/technetwork/articles/javase/security-137537.html
// Note: When a security manager is installed,
// the following call requires SecurityPermission
// "authProvider.SunMSCAPI".
ks.load(null, null);
关于java - 使用 Java 和 SunMSCAPI 从 MS 证书存储中删除证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29519186/
我们正在尝试使用 SunMSCAPI 从 Windows 证书存储中检索证书。我创建了一个非常简单的示例来加载 keystore 并列出可用的别名。但是,即使我在 keystore 中看到两个个人证书
我有几个程序使用 SunMSCAPI 来读取需要 SSL 证书的网页。我的代码在 Windows XP(32 位)下工作,但在我全新安装的 Windows 7(64 位)下不起作用。这是一段代码: S
我们为我们的网站创建了一个新站点,我们让用户可以使用我们设计的小程序来签署 pdf 文档。问题是此小程序仅在 Windows 操作系统中运行良好,我们希望将其扩展到 linux 操作系统。 当我们在
我们有客户端-服务器应用程序,我们使用 java web start 启动客户端应用程序。 在尝试打开客户端应用程序时,它首先从 https url(用于 SSO)读取 token 文件,然后打开另一
我有一个带有私钥的证书存储在 Windows 证书库中。如何使用此 key 解密使用 OAEP 填充的消息?我可以使用 BouncycaSTLe 提供程序和 pfx 文件(PKCS12 keystor
我有以下场景:一个 Java 桌面应用程序,它使用反射调用 Java Legacy 类。遗留模块执行一些 native 操作(访问智能卡)。 在 Eclipse 上运行时一切正常:我将 Java 桌面
我正在开发一个使用证书 token 签署文档的 Java 代码。到目前为止,一切都很好,但我想取消“输入 pin”对话框,因为我正在存储用户的 pin,这样他/她就不需要每次都输入它。这里真正的问题是
我想用 SunMSCAPI 提供商签署文件。由于需要使用 MS Crypto API 导入公钥和签名。 通常使用 SHA1withRSA 生成签名,以大端到小端(字节顺序)转换结束。 //genera
是否可以配置 Tomcat 7 SSL 以通过 SunMSCAPI 访问证书? 我们目前正在将 Tomcat 7 部署到 Azure PAAS 云服务,该服务将所有实例创建为 Windows 服务器。
我正在尝试从 Windows 的“受信任的根证书颁发机构”证书存储中删除证书。可以使用 SunMSCAPI 提供程序并根据 oracle's documentation 从 java 访问此存储。人们
有没有办法使用SunMSCAPI通过Java访问Windows本地计算机个人 key 存储? 通常,您可以使用WINDOWS-ROOT(大致相当于Java中的受信任存储)或WINDOWS-MY(其中包
直到早上,我的小程序中一切正常。我进行了 Java 更新,一切都停止了。我正在使用小程序处理数字证书。这是我的堆栈跟踪。我关注了一些 oracle 文章,但没有用。 https://blogs.ora
我有一个 Java 应用程序,它使用智能卡中的证书进行 TLS/SSL 客户端身份验证。智能卡有 2 个证书,一个用于签名,另一个用于身份验证。我就是这样做的: // loading wind
我是一名优秀的程序员,十分优秀!