Class PDSignature
java.lang.Object
org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature
- All Implemented Interfaces:
COSObjectable
This represents a digital signature that can be attached to a document.
- Version:
- $Revision: 1.2 $
- Author:
- Ben Litchfield, Thomas Chojecki
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final COSName
A signature filter value.static final COSName
A signature filter value.static final COSName
A signature filter value.static final COSName
A signature filter value.static final COSName
A signature subfilter value.static final COSName
A signature subfilter value.static final COSName
A signature subfilter value.static final COSName
A signature subfilter value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint[]
Read out the byterange from the file.Returns the contact info.byte[]
getContents
(byte[] pdfFile) Will return the embedded signature between the byterange gap.byte[]
getContents
(InputStream pdfFile) Will return the embedded signature between the byterange gap.Convert this standard java object to a COS object.Convert this standard java object to a COS dictionary.Returns the filter.Returns the location.getName()
Returns the name.PDF signature build dictionary.Returns the reason.Returns the sign date.byte[]
getSignedContent
(byte[] pdfFile) Will return the signed content of the document.byte[]
getSignedContent
(InputStream pdfFile) Will return the signed content of the document.Returns the subfilter.void
setByteRange
(int[] range) Sets the byte range.void
setContactInfo
(String contactInfo) Sets the contact info.void
setContents
(byte[] bytes) Sets the contents.void
Set the filter.void
setLocation
(String location) Sets the location.void
Sets the name.void
setPropBuild
(PDPropBuild propBuild) PDF signature build dictionary.void
Sets the reason.void
setSignDate
(Calendar cal) Set the sign date.void
setSubFilter
(COSName subfilter) Set a subfilter that specify the signature that should be used.void
Set the dictionary type.
-
Field Details
-
FILTER_ADOBE_PPKLITE
A signature filter value. -
FILTER_ENTRUST_PPKEF
A signature filter value. -
FILTER_CICI_SIGNIT
A signature filter value. -
FILTER_VERISIGN_PPKVS
A signature filter value. -
SUBFILTER_ADBE_X509_RSA_SHA1
A signature subfilter value. -
SUBFILTER_ADBE_PKCS7_DETACHED
A signature subfilter value. -
SUBFILTER_ETSI_CADES_DETACHED
A signature subfilter value. -
SUBFILTER_ADBE_PKCS7_SHA1
A signature subfilter value.
-
-
Constructor Details
-
PDSignature
public PDSignature()Default constructor. -
PDSignature
Constructor.- Parameters:
dict
- The signature dictionary.
-
-
Method Details
-
getCOSObject
Convert this standard java object to a COS object.- Specified by:
getCOSObject
in interfaceCOSObjectable
- Returns:
- The cos object that matches this Java object.
-
getDictionary
Convert this standard java object to a COS dictionary.- Returns:
- The COS dictionary that matches this Java object.
-
setType
Set the dictionary type.- Parameters:
type
- is the dictionary type.
-
setFilter
Set the filter.- Parameters:
filter
- the filter to be used
-
setSubFilter
Set a subfilter that specify the signature that should be used.- Parameters:
subfilter
- the subfilter that shall be used.
-
setName
Sets the name.- Parameters:
name
- the name to be used
-
setLocation
Sets the location.- Parameters:
location
- the location to be used
-
setReason
Sets the reason.- Parameters:
reason
- the reason to be used
-
setContactInfo
Sets the contact info.- Parameters:
contactInfo
- the contact info to be used
-
setSignDate
Set the sign date.- Parameters:
cal
- the date to be used as sign date
-
getFilter
Returns the filter.- Returns:
- the filter
-
getSubFilter
Returns the subfilter.- Returns:
- the subfilter
-
getName
Returns the name.- Returns:
- the name
-
getLocation
Returns the location.- Returns:
- the location
-
getReason
Returns the reason.- Returns:
- the reason
-
getContactInfo
Returns the contact info.- Returns:
- teh contact info
-
getSignDate
Returns the sign date.- Returns:
- the sign date
-
setByteRange
public void setByteRange(int[] range) Sets the byte range.- Parameters:
range
- the byte range to be used
-
getByteRange
public int[] getByteRange()Read out the byterange from the file.- Returns:
- a integer array with the byterange
-
getContents
Will return the embedded signature between the byterange gap.- Parameters:
pdfFile
- The signed pdf file as InputStream- Returns:
- a byte array containing the signature
- Throws:
IOException
- if the pdfFile can't be read
-
getContents
Will return the embedded signature between the byterange gap.- Parameters:
pdfFile
- The signed pdf file as byte array- Returns:
- a byte array containing the signature
- Throws:
IOException
- if the pdfFile can't be read
-
setContents
public void setContents(byte[] bytes) Sets the contents.- Parameters:
bytes
- contents to be used
-
getSignedContent
Will return the signed content of the document.- Parameters:
pdfFile
- The signed pdf file as InputStream- Returns:
- a byte array containing only the signed part of the content
- Throws:
IOException
- if the pdfFile can't be read
-
getSignedContent
Will return the signed content of the document.- Parameters:
pdfFile
- The signed pdf file as byte array- Returns:
- a byte array containing only the signed part of the content
- Throws:
IOException
- if the pdfFile can't be read
-
getPropBuild
PDF signature build dictionary. Provides informations about the signature handler.- Returns:
- the pdf signature build dictionary.
-
setPropBuild
PDF signature build dictionary. Provides informations about the signature handler.- Parameters:
propBuild
- the prop build
-