简体   繁体   English

PKCS11Exception ckr_attribute_type_invalid

[英]PKCS11Exception ckr_attribute_type_invalid

I am trying to create a keystore to get a private key with a smart card reader. 我正在尝试创建一个密钥库来获取带有智能卡读卡器的私钥。

String config = "name = AKIS\nlibrary = C:/Windows/System32/akisp11.dll";
Security.addProvider(akisProvider);
KeyStore ks = KeyStore.getInstance("PKCS11", akisProvider);
ks.load(null, "000000".toCharArray());

But it gives me this exception: 但它给了我这个例外:

java.io.IOException: load failed
    at sun.security.pkcs11.P11KeyStore.engineLoad(P11KeyStore.java:763)
    at java.security.KeyStore.load(KeyStore.java:1445)
    at deneme.AkisImzaImpl.dene(AkisImzaImpl.java:55)
    at deneme.Deneme.main(Deneme.java:83)
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_ATTRIBUTE_TYPE_INVALID
    at sun.security.pkcs11.wrapper.PKCS11.C_GetAttributeValue(Native Method)
    at sun.security.pkcs11.wrapper.PKCS11$SynchronizedPKCS11.C_GetAttributeValue(PKCS11.java:1623)
    at sun.security.pkcs11.P11KeyStore.mapLabels(P11KeyStore.java:2277)
    at sun.security.pkcs11.P11KeyStore.engineLoad(P11KeyStore.java:755)
    ... 3 more

This code was working until yesterday. 这段代码一直工作到昨天。 I could not figure out the problem. 我无法弄清楚这个问题。 If you can help me I would really appreciate it. 如果你能帮助我,我会非常感激。

I have worked it out. 我已经解决了。 One of the 3 keys which does not have any ID was extra. 没有任何ID的3个键中的一个是额外的。 I contacted the card company and we removed the extra key. 我联系了卡公司,我们删除了额外的密钥。 Now it loads without a problem. 现在加载没有问题。 Thanks for your help. 谢谢你的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 sun.security.pkcs11.wrapper.PKCS11Exception:CKR_ATTRIBUTE_TYPE_INVALID - sun.security.pkcs11.wrapper.PKCS11Exception: CKR_ATTRIBUTE_TYPE_INVALID PKCS11Exception:CKR_HOST_MEMORY - PKCS11Exception: CKR_HOST_MEMORY PKCS11Exception:CKR_KEY_FUNCTION_NOT_PERMITTED - PKCS11Exception: CKR_KEY_FUNCTION_NOT_PERMITTED AWS cloudhsm C_FindObjectsInit CKR_ATTRIBUTE_TYPE_INVALID - aws cloudhsm C_FindObjectsInit CKR_ATTRIBUTE_TYPE_INVALID 引起:sun.security.pkcs11.wrapper.PKCS11Exception:CKR_DATA_INVALID - Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_DATA_INVALID sun.security.pkcs11.wrapper.PKCS11Exception:CKR_WRAPPED_KEY_INVALID - sun.security.pkcs11.wrapper.PKCS11Exception: CKR_WRAPPED_KEY_INVALID 我的机器睡觉后无法通过Java应用程序与智能卡签名:获取PKCS11Exception:CKR_GENERAL_ERROR - Unable to sign with Smartcard through Java app after my machine has has slept: getting a PKCS11Exception: CKR_GENERAL_ERROR Sun PKCS#11包装器如何调试CKR_TEMPLATE_INCONSISTENT - Sun PKCS#11 Wrapper how to debug CKR_TEMPLATE_INCONSISTENT CKR_KEY_TYPE_INCONSISTENT:在 FIPS 模式下使用 SunPKCS11 和 NSS 派生签名密钥时 - CKR_KEY_TYPE_INCONSISTENT: when deriving signing key in FIPS mode using SunPKCS11 with NSS 从 jdk10 迁移到 jdk11:SSLConnection:CKR_KEY_TYPE_INCONSISTENT - migrating from jdk10 to jdk11 : SSLConnection : CKR_KEY_TYPE_INCONSISTENT
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM