【问题标题】:Auto-importing signature from USB token to PDF?将签名从 USB 令牌自动导入 PDF?
【发布时间】:2013-01-22 11:45:41
【问题描述】:

我想购买third party digital signature library 和 我想使用客户端证书签署 PDF。它仅在我将文件存储在我的 PC 中时才有效。

由于我想使用存储在 USB 令牌中的证书来签署我的 PDF,我应该怎么做才能做到这一点?

这里我有第三方代码,他们使用的是 DLL 文件 C:\Windows\System32\cmP11.dll,但它不在我的系统中。下面代码中这个文件的任务是什么?

private static void signatureWithToken() {

  // specify document to sign
  PdfDocument pdfDocument = new PdfDocument("sample.pdf");

  // specify info to find a key on the token
  String tokenLibraryFilename = "C:\\Windows\\System32\\cmP11.dll";  // path to token PKCS#11 library
  String tokenPin = "7777";  // token PIN
  // key alias on the token,
  // if null the first found key will be used
  String tokenKeyAlias = "Key Alias";
  SigningData signingData = SigningData.fromPkcs11Token(tokenLibraryFilename, 
      tokenKeyAlias, tokenPin);

  // list available aliases
  listAvailableAliases(signingData);

  // specify rectangle for the signature
  signingData.setFieldRectangle(new Rectangle2D.Float(300, 50, 275, 100));

  // specify reason and location
  signingData.setReason("I approve this invoice.");
  signingData.setLocation("Camden");    

  // sign document
  pdfDocument.signDocument(signingData, "sample_(signed_with_token).pdf");      
}

【问题讨论】:

  • 我尽力重写你的问题,因为我很难理解原文。请检查是否有任何错误。

标签: java pdf digital-signature


【解决方案1】:

您所指的 DLL 文件是一个 PKCS#11 库,基于代码 cmets。 PKCS#11 是用于与令牌和HSMs 交互的加密 API。

如果您的系统上没有该文件,那么您可能缺少特定 USB 加密令牌的 PKCS#11 库。我建议您查看制造商的网站,看看他们是否可以与您分享。

【讨论】:

    【解决方案2】:

    您需要为您的加密令牌下载并安装驱动程序。这些通常在制造商网站上可用。这些 DLL 文件是加密令牌的驱动程序。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-20
      • 2018-04-24
      • 1970-01-01
      • 1970-01-01
      • 2020-12-12
      • 1970-01-01
      • 2022-07-13
      相关资源
      最近更新 更多