Windows maintains a certificate and digital ID store. Digital IDs in the store can come from certificate authorities, or can come from USB hardware tokens.

Our Java libraries jPDFSecurejPDFProcess and visual components jPDFNotes or jPDFEditor can apply a digital signature to a PDF document using a digital ID from the Windows certificate store.

Here is sample java code showing how to retrieve the personal IDs from the Windows store and then sign a PDF using jPDFSecure:

// Create a keystore for Windows personal certificates
KeyStore ks = KeyStore.getInstance("Windows-MY");
ks.load(null, null);
 
// Get the aliases in the keystore
Enumeration aliases = ks.aliases();
if (aliases.hasMoreElements() == false)
{
 System.out.println ("No digital IDs found in token.");
 System.exit(-1);
}
String idAlias = (String)aliases.nextElement();
 
// Load PDF document with jPDFSecure 
PDFSecure pdf = new PDFSecure ("input.pdf", null); 
 
// Add a signature field to the document 
SignatureField signField = pdf.addSignatureField(0, "SignHere", new Rectangle2D.Double(180, 72, 200, 60)); 
 
// Create signature information from the keystore and personal Windows certificate 
SigningInformation signingInfo = new SigningInformation(ks, idAlias, "password"); 
 
// Sign and save the document 
pdf.signDocument(signField, signingInfo); 
pdf.saveDocument("signed.pdf");

Download full sample Java code to sign with Windows ID