public class PadesTwoPhaseSigningHelper extends Object
Firstly createCMSContainerWithoutSignature(java.security.cert.Certificate[], java.lang.String, com.itextpdf.kernel.pdf.PdfReader, java.io.OutputStream, com.itextpdf.signatures.SignerProperties) prepares document and placeholder
for future signature without actual signing process.
Secondly follow-up step signs prepared document with corresponding PAdES Baseline profile.
| Constructor and Description |
|---|
PadesTwoPhaseSigningHelper()
Create instance of
PadesTwoPhaseSigningHelper. |
| Modifier and Type | Method and Description |
|---|---|
CMSContainer |
createCMSContainerWithoutSignature(Certificate[] certificates,
String digestAlgorithm,
PdfReader inputDocument,
OutputStream outputStream,
SignerProperties signerProperties)
Creates CMS container compliant with PAdES level.
|
PadesTwoPhaseSigningHelper |
setCrlClient(ICrlClient crlClient)
Set
ICrlClient to be used for LTV Verification. |
PadesTwoPhaseSigningHelper |
setEstimatedSize(int estimatedSize)
Set estimated size of a signature to be applied.
|
PadesTwoPhaseSigningHelper |
setIssuingCertificateRetriever(IIssuingCertificateRetriever issuingCertificateRetriever)
Set
IIssuingCertificateRetriever to be used before main signing operation. |
PadesTwoPhaseSigningHelper |
setOcspClient(IOcspClient ocspClient)
Set
IOcspClient to be used for LTV Verification. |
PadesTwoPhaseSigningHelper |
setStampingProperties(StampingProperties stampingProperties)
Set stamping properties to be used during main signing operation.
|
PadesTwoPhaseSigningHelper |
setTemporaryDirectoryPath(String temporaryDirectoryPath)
Set temporary directory to be used for temporary files creation.
|
PadesTwoPhaseSigningHelper |
setTimestampSignatureName(String timestampSignatureName)
Set the name to be used for timestamp signature creation.
|
PadesTwoPhaseSigningHelper |
setTrustedCertificates(List<Certificate> certificateList)
Set certificate list to be used by the
IIssuingCertificateRetriever to retrieve missing certificates. |
PadesTwoPhaseSigningHelper |
setTSAClient(ITSAClient tsaClient)
Set
ITSAClient to be used for timestamp signature creation. |
void |
signCMSContainerWithBaselineBProfile(IExternalSignature externalSignature,
PdfReader inputDocument,
OutputStream outputStream,
String signatureFieldName,
CMSContainer cmsContainer)
Follow-up step that signs prepared document with PAdES Baseline-B profile.
|
void |
signCMSContainerWithBaselineLTAProfile(IExternalSignature externalSignature,
PdfReader inputDocument,
OutputStream outputStream,
String signatureFieldName,
CMSContainer cmsContainer)
Follow-up step that signs prepared document with PAdES Baseline-LTA profile.
|
void |
signCMSContainerWithBaselineLTProfile(IExternalSignature externalSignature,
PdfReader inputDocument,
OutputStream outputStream,
String signatureFieldName,
CMSContainer cmsContainer)
Follow-up step that signs prepared document with PAdES Baseline-LT profile.
|
void |
signCMSContainerWithBaselineTProfile(IExternalSignature externalSignature,
PdfReader inputDocument,
OutputStream outputStream,
String signatureFieldName,
CMSContainer cmsContainer)
Follow-up step that signs prepared document with PAdES Baseline-T profile.
|
public PadesTwoPhaseSigningHelper()
PadesTwoPhaseSigningHelper.
Same instance shall not be used for different signing operations, but can be used for both
createCMSContainerWithoutSignature(java.security.cert.Certificate[], java.lang.String, com.itextpdf.kernel.pdf.PdfReader, java.io.OutputStream, com.itextpdf.signatures.SignerProperties) and follow-up signing.
public PadesTwoPhaseSigningHelper setOcspClient(IOcspClient ocspClient)
IOcspClient 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.
ocspClient - IOcspClient instance to be used for LTV VerificationPadesTwoPhaseSigningHelperpublic PadesTwoPhaseSigningHelper setTrustedCertificates(List<Certificate> certificateList)
IIssuingCertificateRetriever to retrieve missing certificates.certificateList - certificate list for getting missing certificates in chain
or CRL response issuer certificates.PadesTwoPhaseSigningHelper.public PadesTwoPhaseSigningHelper setCrlClient(ICrlClient crlClient)
ICrlClient 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.
crlClient - ICrlClient instance to be used for LTV VerificationPadesTwoPhaseSigningHelperpublic PadesTwoPhaseSigningHelper setTSAClient(ITSAClient tsaClient)
ITSAClient to be used for timestamp signature creation.
This client has to be set for Baseline-T Profile level and higher.
tsaClient - ITSAClient instance to be used for timestamp signature creation.PadesTwoPhaseSigningHelperpublic PadesTwoPhaseSigningHelper setIssuingCertificateRetriever(IIssuingCertificateRetriever issuingCertificateRetriever)
IIssuingCertificateRetriever to be used before main signing operation.
If none is set, IssuingCertificateRetriever instance will be used instead.
issuingCertificateRetriever - IIssuingCertificateRetriever instance to be used for getting missing
certificates in chain or CRL response issuer certificates.PadesTwoPhaseSigningHelper.public PadesTwoPhaseSigningHelper setEstimatedSize(int estimatedSize)
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.
estimatedSize - amount of bytes to be used as estimated valuePadesTwoPhaseSigningHelperpublic PadesTwoPhaseSigningHelper setTemporaryDirectoryPath(String temporaryDirectoryPath)
If none is set, temporary documents will be created in memory.
temporaryDirectoryPath - String representing relative or absolute path to the directoryPadesTwoPhaseSigningHelperpublic PadesTwoPhaseSigningHelper setTimestampSignatureName(String timestampSignatureName)
This setter is only relevant if
PdfPadesSigner.signWithBaselineLTAProfile(com.itextpdf.signatures.SignerProperties, java.security.cert.Certificate[], com.itextpdf.signatures.IExternalSignature, com.itextpdf.signatures.ITSAClient) or PdfPadesSigner.prolongSignatures(com.itextpdf.signatures.ITSAClient) methods are used.
If none is set, randomly generated signature name will be used.
timestampSignatureName - String representing the name of a timestamp signature to be appliedPadesTwoPhaseSigningHelperpublic PadesTwoPhaseSigningHelper setStampingProperties(StampingProperties stampingProperties)
If none is set, stamping properties with append mode enabled will be used
stampingProperties - StampingProperties instance to be used during main signing operationPadesTwoPhaseSigningHelperpublic CMSContainer createCMSContainerWithoutSignature(Certificate[] certificates, String digestAlgorithm, PdfReader inputDocument, OutputStream outputStream, SignerProperties signerProperties) throws IOException, GeneralSecurityException
certificates - certificates to be added to the CMS containerdigestAlgorithm - the algorithm to generate the digest withinputDocument - reader PdfReader instance to read original PDF fileoutputStream - OutputStream output stream to write the resulting PDF file intosignerProperties - properties to be used in the signing operationsIOException - if an I/O error occurs.GeneralSecurityException - if some problem with signature or security occur.public void signCMSContainerWithBaselineBProfile(IExternalSignature externalSignature, PdfReader inputDocument, OutputStream outputStream, String signatureFieldName, CMSContainer cmsContainer) throws Exception
externalSignature - external signature to do the actual signinginputDocument - reader PdfReader instance to read prepared documentoutputStream - the output PDFsignatureFieldName - the field to signcmsContainer - the finalized CMS container (e.g. created in the first step)Exception - if some exception occur.public void signCMSContainerWithBaselineTProfile(IExternalSignature externalSignature, PdfReader inputDocument, OutputStream outputStream, String signatureFieldName, CMSContainer cmsContainer) throws Exception
externalSignature - external signature to do the actual signinginputDocument - reader PdfReader instance to read prepared documentoutputStream - the output PDFsignatureFieldName - the field to signcmsContainer - the finalized CMS container (e.g. created in the first step)Exception - if some exception occur.public void signCMSContainerWithBaselineLTProfile(IExternalSignature externalSignature, PdfReader inputDocument, OutputStream outputStream, String signatureFieldName, CMSContainer cmsContainer) throws Exception
externalSignature - external signature to do the actual signinginputDocument - reader PdfReader instance to read prepared documentoutputStream - the output PDFsignatureFieldName - the field to signcmsContainer - the finalized CMS container (e.g. created in the first step)Exception - if some exception occur.public void signCMSContainerWithBaselineLTAProfile(IExternalSignature externalSignature, PdfReader inputDocument, OutputStream outputStream, String signatureFieldName, CMSContainer cmsContainer) throws Exception
externalSignature - external signature to do the actual signinginputDocument - reader PdfReader instance to read prepared documentoutputStream - the output PDFsignatureFieldName - the field to signcmsContainer - the finalized CMS container (e.g. created in the first step)Exception - if some exception occur.Copyright © 1998–2024 Apryse Group NV. All rights reserved.