如何使用 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;
    }

对运行代码有什么帮助或平安吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)