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
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
ConstructorDescriptionCreateSignature
(File ksFile, String keyStorePassword, String alias, String aliasPassword) Initialize the signature creator with a keystore and certficate password. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Signs the given PDF filevoid
signDetached
(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 Details
-
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 Details
-
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
-