2013-01-22 33 views
0

我想購買third party digital signature library和 我想使用客戶端證書籤署PDF。它只有當我得到的文件存儲在我的電腦時才起作用。從USB令牌自動導入簽名爲PDF?

由於我想通過使用存儲在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");  
} 
+0

我試着重新寫你的問題,因爲我努力去理解原文。請檢查是否有錯誤。 –

回答

3

您提到的DLL文件是基於代碼註釋的PKCS#11庫。 PKCS#11是一種用於與令牌和HSMs交互的加密API。

如果您的系統中沒有該文件,那麼可能是因爲您的特定USB加密標記丟失了PKCS#11庫。我建議你看看製造商的網站,看看他們是否可以與你分享。

0

您需要下載並安裝加密令牌的驅動程序。這些通常在製造商網站上提供。這些DLL文件是加密標記的驅動程序。