Package com.logicaldoc.sign.pdf
Class CreateSignature
- java.lang.Object
-
- com.logicaldoc.sign.pdf.CreateSignatureBase
-
- com.logicaldoc.sign.pdf.CreateSignature
-
- All Implemented Interfaces:
org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface
public class CreateSignature extends CreateSignatureBase
Signs a PDF with pdf box. A keystore can be created with the java keytool.- Since:
- 7.7.2
- Author:
- Marco Meschieri - LogicalDOC
-
-
Constructor Summary
Constructors Constructor Description CreateSignature(File ksFile, String keyStorePassword, String alias, String aliasPassword)Initialize the signature creator with a keystore and certficate password.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsignDetached(File inFile, File outFile, String name, String location, String reason)Signs the given PDF filevoidsignDetached(org.apache.pdfbox.pdmodel.PDDocument document, OutputStream output, String name, String location, String reason)-
Methods inherited from class com.logicaldoc.sign.pdf.CreateSignatureBase
getMDPPermission, isExternalSigning, setCertificateChain, setExternalSigning, setMDPPermission, setPrivateKey, sign
-
-
-
-
Constructor Detail
-
CreateSignature
public CreateSignature(File ksFile, String keyStorePassword, String alias, String aliasPassword) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException, IOException, CertificateException
Initialize the signature creator with a keystore and certficate password.- Parameters:
ksFile- the java keystore file containing the signing certificatekeyStorePassword- the password for opening the keystorealias- the alias of the certificatealiasPassword- the password to open the alias- Throws:
NoSuchAlgorithmException- if the algorithm for recovering the key cannot be foundUnrecoverableKeyException- if the given password is wrongCertificateException- if the certificate is not valid as signing timeIOException- if no certificate could be foundCertificateException- the digital certificate cannot be extractedKeyStoreException- error accessing the keystoreUnrecoverableKeyException- error accessing the certificateNoSuchAlgorithmException- generic encryption issue
-
-
Method Detail
-
signDetached
public void signDetached(File inFile, File outFile, String name, String location, String reason) throws IOException
Signs the given PDF file- Parameters:
inFile- input PDF fileoutFile- output PDF filename- name of the signerlocation- the locationreason- the reason for signing- Throws:
IOException- if no certificate could be found
-
signDetached
public void signDetached(org.apache.pdfbox.pdmodel.PDDocument document, OutputStream output, String name, String location, String reason) throws IOException- Throws:
IOException
-
-