I want to digitally sign a PDF file using a certificate stored on a USB-token, HSM, etc. How do I use the private key stored on the USB token using JAVA?
Seems like you want to digitally sign a PDF using an USB token, a smart-card or a Hardware Security Module. This is done through PKCS#11 as explained in http://itextpdf.com/book/digitalsignatures You can find the source code here. This is an example showing how to sign using a SafeNet iKey 400 USB token.