pkcs#11 - 如何使用 IAIK 包装器 1.6.2 读取数据对象
问题描述
我的问题是我正在使用带有令牌的以下 IAIK 版本
- 提供者:1.5
- 包装:1.4
- JCE:5.25
- Safenet PKCS11 驱动程序:10.2
现在我想使用最新版本:
- 提供者:1.6.2
- 包装:1.7
- JCE:5.62
- Safenet PKCS11 驱动程序:10.8 R2
最大的问题是我无法再读取数据对象,即使
session.findObjectsInit(null);
对于旧版本,使用以下模板我可以获得数据对象:
private static GenericTemplate getTokenObjectTemplate3(String label) {
Preconditions.checkArgument(label != null);
GenericTemplate template = new GenericTemplate();
LongAttribute objectClassAttribute = new LongAttribute(PKCS11Constants.CKA_CLASS);
objectClassAttribute.setLongValue(new Long(PKCS11Constants.CKO_DATA));
template.addAttribute(objectClassAttribute);
CharArrayAttribute labelAttribute = new CharArrayAttribute(PKCS11Constants.CKA_LABEL);
labelAttribute.setCharArrayValue("oostatus".toCharArray());
template.addAttribute(labelAttribute);
BooleanAttribute tokenAttribute = new BooleanAttribute(PKCS11Constants.CKA_TOKEN);
tokenAttribute.setBooleanValue(Boolean.TRUE);
template.addAttribute(tokenAttribute);
BooleanAttribute privateAttribute = new BooleanAttribute(PKCS11Constants.CKA_PRIVATE);
privateAttribute.setBooleanValue(Boolean.FALSE);
template.addAttribute(privateAttribute);
CharArrayAttribute applicationAttribute = new CharArrayAttribute(PKCS11Constants.CKA_APPLICATION);
applicationAttribute.setCharArrayValue(TOKEN_APPLICATION.toCharArray());
template.addAttribute(applicationAttribute);
return template;
}
现在我正在使用以下内容但徒劳无功:
private static Data getTokenObjectTemplate4() {
Data dataObjectTemplate = new Data();
dataObjectTemplate.getLabel().setCharArrayValue(TOKEN_STATUS_LABEL.toCharArray());
return dataObjectTemplate;
}
请问运行代码有什么帮助或和平吗?
解决方案
推荐阅读
- reactjs - 如何使用 React-Hook-Form 处理更改事件?
- java - 使用 Java URI.create 在 HDFS 中写入带空格的文件名导致它失败并出现 IllegalArgumentException
- kiwi-tcms - kiwi tcms 有上传限制吗?
- python-3.x - 将 pytorch 代码移植到 tf2.0:相当于 tf2.0 中的 x_batch.requires_grad = True?
- mysql - 如何从 Docker 流式传输 MySQL 数据库转储
- hive - Hive 中数十亿条记录的查询耗时过长
- azure - Azure Synapse 中的 Openrowset 语法问题
- flutter - ListView - 仅允许双指滚动并禁用单指滚动 (Flutter)
- c# - RijndaelManaged,对于特定的输入,两组不同的密钥都可以解密
- python - 使用增强赋值运算符的主要好处是什么?