Class PdfPadesSigner
-
Constructor Summary
ConstructorDescriptionPdfPadesSigner
(PdfReader reader, OutputStream outputStream) Create an instance of PdfPadesSigner class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add revocation information for all the signatures which could be found in the provided document.void
prolongSignatures
(ITSAClient tsaClient) Add revocation information for all the signatures which could be found in the provided document.setCrlClient
(ICrlClient crlClient) SetICrlClient
to be used for LTV Verification.setEstimatedSize
(int estimatedSize) Set estimated size of a signature to be applied.setExternalDigest
(IExternalDigest externalDigest) SetIExternalDigest
to be used for main signing operation.setIssuingCertificateRetriever
(IIssuingCertificateRetriever issuingCertificateRetriever) SetIIssuingCertificateRetriever
to be used before main signing operation.setOcspClient
(IOcspClient ocspClient) SetIOcspClient
to be used for LTV Verification.setStampingProperties
(StampingProperties stampingProperties) Set stamping properties to be used during main signing operation.setTemporaryDirectoryPath
(String temporaryDirectoryPath) Set temporary directory to be used for temporary files creation.setTimestampSignatureName
(String timestampSignatureName) Set the name to be used for timestamp signature creation.setTrustedCertificates
(List<Certificate> certificateList) Set certificate list to be used by theIIssuingCertificateRetriever
to retrieve missing certificates.void
signWithBaselineBProfile
(SignerProperties signerProperties, Certificate[] chain, IExternalSignature externalSignature) Sign the document provided inPdfSigner
instance with PaDES Baseline-B Profile.void
signWithBaselineBProfile
(SignerProperties signerProperties, Certificate[] chain, PrivateKey privateKey) Sign the document provided inPdfSigner
instance with PaDES Baseline-B Profile.void
signWithBaselineLTAProfile
(SignerProperties signerProperties, Certificate[] chain, IExternalSignature externalSignature, ITSAClient tsaClient) Sign the document provided inPdfSigner
instance with PaDES Baseline-LTA Profile.void
signWithBaselineLTAProfile
(SignerProperties signerProperties, Certificate[] chain, PrivateKey privateKey, ITSAClient tsaClient) Sign the document provided inPdfSigner
instance with PaDES Baseline-LTA Profile.void
signWithBaselineLTProfile
(SignerProperties signerProperties, Certificate[] chain, IExternalSignature externalSignature, ITSAClient tsaClient) Sign the document provided inPdfSigner
instance with PaDES Baseline-LT Profile.void
signWithBaselineLTProfile
(SignerProperties signerProperties, Certificate[] chain, PrivateKey privateKey, ITSAClient tsaClient) Sign the document provided inPdfSigner
instance with PaDES Baseline-LT Profile.void
signWithBaselineTProfile
(SignerProperties signerProperties, Certificate[] chain, IExternalSignature externalSignature, ITSAClient tsaClient) Sign the document provided inPdfSigner
instance with PaDES Baseline-T Profile.void
signWithBaselineTProfile
(SignerProperties signerProperties, Certificate[] chain, PrivateKey privateKey, ITSAClient tsaClient) Sign the document provided inPdfSigner
instance with PaDES Baseline-T Profile.
-
Constructor Details
-
PdfPadesSigner
Create an instance of PdfPadesSigner class. One instance shall be used for one signing operation.- Parameters:
-
reader
-PdfReader
instance to read original PDF file -
outputStream
-OutputStream
output stream to write the resulting PDF file into
-
-
Method Details
-
signWithBaselineBProfile
public void signWithBaselineBProfile(SignerProperties signerProperties, Certificate[] chain, IExternalSignature externalSignature) throws GeneralSecurityException, IOException Sign the document provided inPdfSigner
instance with PaDES Baseline-B Profile.- Parameters:
-
signerProperties
-SignerProperties
properties to be used for main signing operation -
chain
- the chain of certificates to be used for signing operation -
externalSignature
-IExternalSignature
instance to be used for main signing operation - Throws:
-
GeneralSecurityException
- in case of signing related exceptions -
IOException
- in case of files related exceptions
-
signWithBaselineBProfile
public void signWithBaselineBProfile(SignerProperties signerProperties, Certificate[] chain, PrivateKey privateKey) throws GeneralSecurityException, IOException Sign the document provided inPdfSigner
instance with PaDES Baseline-B Profile.- Parameters:
-
signerProperties
-SignerProperties
properties to be used for main signing operation -
chain
- the chain of certificates to be used for signing operation -
privateKey
-PrivateKey
instance to be used for main signing operation - Throws:
-
GeneralSecurityException
- in case of signing related exceptions -
IOException
- in case of files related exceptions
-
signWithBaselineTProfile
public void signWithBaselineTProfile(SignerProperties signerProperties, Certificate[] chain, IExternalSignature externalSignature, ITSAClient tsaClient) throws GeneralSecurityException, IOException Sign the document provided inPdfSigner
instance with PaDES Baseline-T Profile.- Parameters:
-
signerProperties
-SignerProperties
properties to be used for main signing operation -
chain
- the chain of certificates to be used for signing operation -
externalSignature
-IExternalSignature
instance to be used for main signing operation -
tsaClient
-ITSAClient
instance to be used for timestamp creation - Throws:
-
GeneralSecurityException
- in case of signing related exceptions -
IOException
- in case of files related exceptions
-
signWithBaselineTProfile
public void signWithBaselineTProfile(SignerProperties signerProperties, Certificate[] chain, PrivateKey privateKey, ITSAClient tsaClient) throws GeneralSecurityException, IOException Sign the document provided inPdfSigner
instance with PaDES Baseline-T Profile.- Parameters:
-
signerProperties
-SignerProperties
properties to be used for main signing operation -
chain
- the chain of certificates to be used for signing operation -
privateKey
-PrivateKey
instance to be used for main signing operation -
tsaClient
-ITSAClient
instance to be used for timestamp creation - Throws:
-
GeneralSecurityException
- in case of signing related exceptions -
IOException
- in case of files related exceptions
-
signWithBaselineLTProfile
public void signWithBaselineLTProfile(SignerProperties signerProperties, Certificate[] chain, IExternalSignature externalSignature, ITSAClient tsaClient) throws GeneralSecurityException, IOException Sign the document provided inPdfSigner
instance with PaDES Baseline-LT Profile.- Parameters:
-
signerProperties
-SignerProperties
properties to be used for main signing operation -
chain
- the chain of certificates to be used for signing operation -
externalSignature
-IExternalSignature
instance to be used for main signing operation -
tsaClient
-ITSAClient
instance to be used for timestamp creation - Throws:
-
GeneralSecurityException
- in case of signing related exceptions -
IOException
- in case of files related exceptions
-
signWithBaselineLTProfile
public void signWithBaselineLTProfile(SignerProperties signerProperties, Certificate[] chain, PrivateKey privateKey, ITSAClient tsaClient) throws GeneralSecurityException, IOException Sign the document provided inPdfSigner
instance with PaDES Baseline-LT Profile.- Parameters:
-
signerProperties
-SignerProperties
properties to be used for main signing operation -
chain
- the chain of certificates to be used for signing operation -
privateKey
-PrivateKey
instance to be used for main signing operation -
tsaClient
-ITSAClient
instance to be used for timestamp creation - Throws:
-
GeneralSecurityException
- in case of signing related exceptions -
IOException
- in case of files related exceptions
-
signWithBaselineLTAProfile
public void signWithBaselineLTAProfile(SignerProperties signerProperties, Certificate[] chain, IExternalSignature externalSignature, ITSAClient tsaClient) throws IOException, GeneralSecurityException Sign the document provided inPdfSigner
instance with PaDES Baseline-LTA Profile.- Parameters:
-
signerProperties
-SignerProperties
properties to be used for main signing operation -
chain
- the chain of certificates to be used for signing operation -
externalSignature
-IExternalSignature
instance to be used for main signing operation -
tsaClient
-ITSAClient
instance to be used for timestamp creation - Throws:
-
GeneralSecurityException
- in case of signing related exceptions -
IOException
- in case of files related exceptions
-
signWithBaselineLTAProfile
public void signWithBaselineLTAProfile(SignerProperties signerProperties, Certificate[] chain, PrivateKey privateKey, ITSAClient tsaClient) throws GeneralSecurityException, IOException Sign the document provided inPdfSigner
instance with PaDES Baseline-LTA Profile.- Parameters:
-
signerProperties
-SignerProperties
properties to be used for main signing operation -
chain
- the chain of certificates to be used for signing operation -
privateKey
-PrivateKey
instance to be used for main signing operation -
tsaClient
-ITSAClient
instance to be used for timestamp creation - Throws:
-
GeneralSecurityException
- in case of signing related exceptions -
IOException
- in case of files related exceptions
-
prolongSignatures
Add revocation information for all the signatures which could be found in the provided document. Also add timestamp signature on top of that.- Parameters:
-
tsaClient
-ITSAClient
TSA Client to be used for timestamp signature creation - Throws:
-
IOException
- in case of files related exceptions -
GeneralSecurityException
- in case of signing related exceptions
-
prolongSignatures
Add revocation information for all the signatures which could be found in the provided document.- Throws:
-
IOException
- in case of files related exceptions -
GeneralSecurityException
- in case of signing related exceptions
-
setTemporaryDirectoryPath
Set temporary directory to be used for temporary files creation.If none is set, temporary documents will be created in memory.
- Parameters:
-
temporaryDirectoryPath
-String
representing relative or absolute path to the directory - Returns:
-
same instance of
PdfPadesSigner
-
setTimestampSignatureName
Set the name to be used for timestamp signature creation.This setter is only relevant if
signWithBaselineLTAProfile(com.itextpdf.signatures.SignerProperties, java.security.cert.Certificate[], com.itextpdf.signatures.IExternalSignature, com.itextpdf.signatures.ITSAClient)
orprolongSignatures(com.itextpdf.signatures.ITSAClient)
methods are used.If none is set, randomly generated signature name will be used.
- Parameters:
-
timestampSignatureName
-String
representing the name of a timestamp signature to be applied - Returns:
-
same instance of
PdfPadesSigner
-
setStampingProperties
Set stamping properties to be used during main signing operation.If none is set, stamping properties with append mode enabled will be used
- Parameters:
-
stampingProperties
-StampingProperties
instance to be used during main signing operation - Returns:
-
same instance of
PdfPadesSigner
-
setEstimatedSize
Set estimated size of a signature to be applied.This parameter represents estimated amount of bytes to be preserved for the signature.
If none is set, 0 will be used and the required space will be calculated during the signing.
- Parameters:
-
estimatedSize
- amount of bytes to be used as estimated value - Returns:
-
same instance of
PdfPadesSigner
-
setOcspClient
SetIOcspClient
to be used for LTV Verification.This setter is only relevant if Baseline-LT Profile level or higher is used.
If none is set, there will be an attempt to create default OCSP Client instance using the certificate chain.
- Parameters:
-
ocspClient
-IOcspClient
instance to be used for LTV Verification - Returns:
-
same instance of
PdfPadesSigner
-
setCrlClient
SetICrlClient
to be used for LTV Verification.This setter is only relevant if Baseline-LT Profile level or higher is used.
If none is set, there will be an attempt to create default CRL Client instance using the certificate chain.
- Parameters:
-
crlClient
-ICrlClient
instance to be used for LTV Verification - Returns:
-
same instance of
PdfPadesSigner
-
setExternalDigest
SetIExternalDigest
to be used for main signing operation.If none is set,
BouncyCastleDigest
instance will be used instead.- Parameters:
-
externalDigest
-IExternalDigest
to be used for main signing operation. - Returns:
-
same instance of
PdfPadesSigner
-
setIssuingCertificateRetriever
public PdfPadesSigner setIssuingCertificateRetriever(IIssuingCertificateRetriever issuingCertificateRetriever) SetIIssuingCertificateRetriever
to be used before main signing operation.If none is set,
IssuingCertificateRetriever
instance will be used instead.- Parameters:
-
issuingCertificateRetriever
-IIssuingCertificateRetriever
instance to be used for getting missing certificates in chain or CRL response issuer certificates. - Returns:
-
same instance of
PdfPadesSigner
.
-
setTrustedCertificates
Set certificate list to be used by theIIssuingCertificateRetriever
to retrieve missing certificates.- Parameters:
-
certificateList
- certificate list for getting missing certificates in chain or CRL response issuer certificates. - Returns:
-
same instance of
PdfPadesSigner
.
-