Package com.logicaldoc.sign.pdf
Class CreateSignatureBase
java.lang.Object
com.logicaldoc.sign.pdf.CreateSignatureBase
- All Implemented Interfaces:
org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface
- Direct Known Subclasses:
CreateSignature
,CreateVisibleSignature
public abstract class CreateSignatureBase
extends Object
implements org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface
Common base for signature creators
- Since:
- 7.7.2
- Author:
- Marco Meschieri - LogicalDOC
-
Method Summary
Modifier and TypeMethodDescriptionint
getMDPPermission
(org.apache.pdfbox.pdmodel.PDDocument doc) Get the access permissions granted for this document in the DocMDP transform parameters dictionary.boolean
final void
setCertificateChain
(Certificate[] certificateChain) void
setExternalSigning
(boolean externalSigning) Set if external signing scenario should be used.void
setMDPPermission
(org.apache.pdfbox.pdmodel.PDDocument doc, org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature signature, int accessPermissions) final void
setPrivateKey
(PrivateKey privateKey) byte[]
sign
(InputStream content) SignatureInterface implementation.
-
Method Details
-
setPrivateKey
-
setCertificateChain
-
sign
SignatureInterface implementation. This method will be called from inside of the pdfbox and create the PKCS #7 signature. The given InputStream contains the bytes that are given by the byte range. This method is for internal use only. Use your favorite cryptographic library to implement PKCS #7 signature creation.- Specified by:
sign
in interfaceorg.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface
- Parameters:
content
- the content of the file- Throws:
IOException
- cannot write the PDF file
-
setExternalSigning
public void setExternalSigning(boolean externalSigning) Set if external signing scenario should be used. Iffalse
, SignatureInterface would be used for signing.Default:
false
- Parameters:
externalSigning
-true
if external signing should be performed
-
isExternalSigning
public boolean isExternalSigning() -
getMDPPermission
public int getMDPPermission(org.apache.pdfbox.pdmodel.PDDocument doc) Get the access permissions granted for this document in the DocMDP transform parameters dictionary. Details are described in the table "Entries in the DocMDP transform parameters dictionary" in the PDF specification.- Parameters:
doc
- document.- Returns:
- the permission value. 0 means no DocMDP transform parameters dictionary exists. Other return values are 1, 2 or 3. 2 is also returned if the DocMDP transform parameters dictionary is found but did not contain a /P entry, or if the value is outside the valid range.
-
setMDPPermission
public void setMDPPermission(org.apache.pdfbox.pdmodel.PDDocument doc, org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature signature, int accessPermissions)
-