Package es.gob.afirma.signature.pades
Class PAdESBaselineSigner
- java.lang.Object
-
- es.gob.afirma.signature.pades.PAdESBaselineSigner
-
- All Implemented Interfaces:
Signer
public final class PAdESBaselineSigner extends java.lang.Object implements Signer
Class that manages the generation, validation and upgrade of PAdES Baseline signatures.
Project:Library for the integration with the services of @Firma, eVisor and TS@.
- Version:
- 1.4, 18/04/2022.
-
-
Constructor Summary
Constructors Constructor Description PAdESBaselineSigner()Constructor method for the class PAdESBaselineSigner.java.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]coSign(byte[] signature, byte[] document, java.lang.String algorithm, java.security.KeyStore.PrivateKeyEntry privateKey, java.util.Properties extraParams, boolean includeTimestamp, java.lang.String signatureForm, java.lang.String signaturePolicyID)Method that generates a basic co-signature (signature with signers on parallel).byte[]coSign(byte[] signature, byte[] document, java.lang.String algorithm, java.security.KeyStore.PrivateKeyEntry privateKey, java.util.Properties extraParams, boolean includeTimestamp, java.lang.String signatureForm, java.lang.String signaturePolicyID, java.lang.String idClient)Method that generates a basic co-signature (signature with signers on parallel).byte[]counterSign(byte[] signature, java.lang.String algorithm, java.security.KeyStore.PrivateKeyEntry privateKey, java.util.Properties extraParams, boolean includeTimestamp, java.lang.String signatureForm, java.lang.String signaturePolicyID)Method that generates a basic counter-signature (signature with signers on serial).byte[]counterSign(byte[] signature, java.lang.String algorithm, java.security.KeyStore.PrivateKeyEntry privateKey, java.util.Properties extraParams, boolean includeTimestamp, java.lang.String signatureForm, java.lang.String signaturePolicyID, java.lang.String idClient)Method that generates a basic counter-signature (signature with signers on serial).OriginalSignedDatagetSignedData(byte[] pdfDocument)Method that obtains the data originally signed from a signature.static java.util.DategetValidationDateForSignatureDictionary(CAdESSignerInfo signerInfo, java.lang.Integer signatureDictionaryRevision, java.util.List<PDFDocumentTimestampDictionary> listTimestampDictionaries)Method that obtains the date to use for validating a signature dictionary.byte[]sign(byte[] data, java.lang.String algorithm, java.lang.String signatureFormat, java.security.KeyStore.PrivateKeyEntry privateKey, java.util.Properties extraParams, boolean includeTimestamp, java.lang.String signatureForm, java.lang.String signaturePolicyID)Method that generates a basic signature.byte[]sign(byte[] data, java.lang.String algorithm, java.lang.String signatureFormat, java.security.KeyStore.PrivateKeyEntry privateKey, java.util.Properties extraParams, boolean includeTimestamp, java.lang.String signatureForm, java.lang.String signaturePolicyID, java.lang.String idClient)Method that generates a basic signature.byte[]upgrade(byte[] pdfDocument, java.util.List<java.security.cert.X509Certificate> listSigners)Method that upgrades a signature adding a timestamp to all of the signers indicated.byte[]upgrade(byte[] pdfDocument, java.util.List<java.security.cert.X509Certificate> listSigners, java.lang.String idClient)Method that upgrades a signature adding a timestamp to all of the signers indicated.PDFValidationResultverifySignature(byte[] pdfDocument)Method that verifies all the signature dictionaries and document Time-stamp dictionaries of a PDF document.PDFValidationResultverifySignature(byte[] pdfDocument, java.lang.String idClient)Method that validates a signed PDF document.
-
-
-
Method Detail
-
sign
public byte[] sign(byte[] data, java.lang.String algorithm, java.lang.String signatureFormat, java.security.KeyStore.PrivateKeyEntry privateKey, java.util.Properties extraParams, boolean includeTimestamp, java.lang.String signatureForm, java.lang.String signaturePolicyID, java.lang.String idClient) throws SigningExceptionMethod that generates a basic signature.- Specified by:
signin interfaceSigner- Parameters:
data- Parameter that represents the data to sign.algorithm- Parameter that represents the signature algorithm.signatureFormat- Parameter that represents the signing mode. The allowed values for a CAdES (Baseline or not) signature are: The allowed values for a XAdES (Baseline or not) signature are: The allowed values for PAdES (Baseline or not) signature are:privateKey- Parameter that represents the private key of the signing certificate.extraParams- Set of extra configuration parameters. The allowed parameters are:SignatureProperties.CADES_POLICY_QUALIFIER_PROP. This property is only allowed for CAdES (Baseline or not) signatures.SignatureProperties.XADES_CLAIMED_ROLE_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_POLICY_QUALIFIER_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_DESCRIPTION_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_MIME_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_ENCODING_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.PADES_CERTIFICATION_LEVEL. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_CONTACT_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOCATION_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_REASON_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOWER_LEFT_X. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOWER_LEFT_Y. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_UPPER_RIGHT_X. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_UPPER_RIGHT_Y. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_IMAGE. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_IMAGE_PAGE. This property is only allowed for PAdES (Baseline or not) signatures.
includeTimestamp- Parameter that indicates if the signature will include a timestamp (true) or not (false).signatureForm- Parameter that represents the signature form. The allowed values for CAdES signature are: The allowed values for CAdES Baseline signature are: The allowed values for XAdES signature are: The allowed values for XAdES Baseline signature are: The allowed values for PAdES signature are: The allowed values for PAdES Baseline signature are:signaturePolicyID- Parameter that represents the identifier of the signature policy used for generate the signature with signature policies. The identifier must be defined on the properties file where to configure the validation and generation of signatures with signature policies.idClient- Parameter that represents the client application identifier.- Returns:
- an object that represents the generated signature.
- Throws:
SigningException- If the method fails.- See Also:
Signer.sign(byte[], java.lang.String, java.lang.String, java.security.KeyStore.PrivateKeyEntry, java.util.Properties, boolean, java.lang.String, java.lang.String, java.lang.String)
-
sign
public byte[] sign(byte[] data, java.lang.String algorithm, java.lang.String signatureFormat, java.security.KeyStore.PrivateKeyEntry privateKey, java.util.Properties extraParams, boolean includeTimestamp, java.lang.String signatureForm, java.lang.String signaturePolicyID) throws SigningExceptionMethod that generates a basic signature.- Specified by:
signin interfaceSigner- Parameters:
data- Parameter that represents the data to sign.algorithm- Parameter that represents the signature algorithm.signatureFormat- Parameter that represents the signing mode. The allowed values for a CAdES (Baseline or not) signature are: The allowed values for a XAdES (Baseline or not) signature are: The allowed values for PAdES (Baseline or not) signature are:privateKey- Parameter that represents the private key of the signing certificate.extraParams- Set of extra configuration parameters. The allowed parameters are:SignatureProperties.CADES_POLICY_QUALIFIER_PROP. This property is only allowed for CAdES (Baseline or not) signatures.SignatureProperties.XADES_CLAIMED_ROLE_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_POLICY_QUALIFIER_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_DESCRIPTION_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_MIME_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_ENCODING_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.PADES_CERTIFICATION_LEVEL. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_CONTACT_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOCATION_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_REASON_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOWER_LEFT_X. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOWER_LEFT_Y. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_UPPER_RIGHT_X. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_UPPER_RIGHT_Y. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_IMAGE. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_IMAGE_PAGE. This property is only allowed for PAdES (Baseline or not) signatures.
includeTimestamp- Parameter that indicates if the signature will include a timestamp (true) or not (false).signatureForm- Parameter that represents the signature form. The allowed values for CAdES signature are: The allowed values for CAdES Baseline signature are: The allowed values for XAdES signature are: The allowed values for XAdES Baseline signature are: The allowed values for PAdES signature are: The allowed values for PAdES Baseline signature are:signaturePolicyID- Parameter that represents the identifier of the signature policy used for generate the signature with signature policies. The identifier must be defined on the properties file where to configure the validation and generation of signatures with signature policies.- Returns:
- an object that represents the generated signature.
- Throws:
SigningException- If the method fails.- See Also:
Signer.sign(byte[], java.lang.String, java.lang.String, java.security.KeyStore.PrivateKeyEntry, java.util.Properties, boolean, java.lang.String, java.lang.String)
-
coSign
public byte[] coSign(byte[] signature, byte[] document, java.lang.String algorithm, java.security.KeyStore.PrivateKeyEntry privateKey, java.util.Properties extraParams, boolean includeTimestamp, java.lang.String signatureForm, java.lang.String signaturePolicyID, java.lang.String idClient) throws SigningExceptionMethod that generates a basic co-signature (signature with signers on parallel). This functionality is unsupported for PAdES (Baseline or not) signatures.- Specified by:
coSignin interfaceSigner- Parameters:
signature- Parameter that represents the original signature.document- Parameter that represents the data used to generate the original signature.algorithm- Parameter that represents the signature algorithm.privateKey- Parameter that represents the private key of the signing certificate.extraParams- Set of extra configuration parameters. The allowed parameters are:SignatureProperties.CADES_POLICY_QUALIFIER_PROP. This property is only allowed for CAdES (Baseline or not) signatures.SignatureProperties.XADES_CLAIMED_ROLE_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_POLICY_QUALIFIER_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_DESCRIPTION_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_MIME_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_ENCODING_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.PADES_CERTIFICATION_LEVEL. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_CONTACT_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOCATION_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_REASON_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOWER_LEFT_X. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOWER_LEFT_Y. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_UPPER_RIGHT_X. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_UPPER_RIGHT_Y. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_IMAGE. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_IMAGE_PAGE. This property is only allowed for PAdES (Baseline or not) signatures.
includeTimestamp- Parameter that indicates if the signature will include a timestamp (true) or not (false).signatureForm- Parameter that represents the signature form. The allowed values for CAdES signature are: The allowed values for CAdES Baseline signature are: The allowed values for XAdES signature are: The allowed values for XAdES Baseline signature are:signaturePolicyID- Parameter that represents the identifier of the signature policy used for generate the signature with signature policies. The identifier must be defined on the properties file where to configure the validation and generation of signatures with signature policies.idClient- Parameter that represents the client application identifier.- Returns:
- an object that represents the generated co-signature.
- Throws:
SigningException- If the method fails.- See Also:
Signer.coSign(byte[], byte[], java.lang.String, java.security.KeyStore.PrivateKeyEntry, java.util.Properties, boolean, java.lang.String, java.lang.String, java.lang.String)
-
coSign
public byte[] coSign(byte[] signature, byte[] document, java.lang.String algorithm, java.security.KeyStore.PrivateKeyEntry privateKey, java.util.Properties extraParams, boolean includeTimestamp, java.lang.String signatureForm, java.lang.String signaturePolicyID) throws SigningExceptionMethod that generates a basic co-signature (signature with signers on parallel). This functionality is unsupported for PAdES (Baseline or not) signatures.- Specified by:
coSignin interfaceSigner- Parameters:
signature- Parameter that represents the original signature.document- Parameter that represents the data used to generate the original signature.algorithm- Parameter that represents the signature algorithm.privateKey- Parameter that represents the private key of the signing certificate.extraParams- Set of extra configuration parameters. The allowed parameters are:SignatureProperties.CADES_POLICY_QUALIFIER_PROP. This property is only allowed for CAdES (Baseline or not) signatures.SignatureProperties.XADES_CLAIMED_ROLE_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_POLICY_QUALIFIER_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_DESCRIPTION_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_MIME_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_ENCODING_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.PADES_CERTIFICATION_LEVEL. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_CONTACT_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOCATION_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_REASON_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOWER_LEFT_X. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOWER_LEFT_Y. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_UPPER_RIGHT_X. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_UPPER_RIGHT_Y. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_IMAGE. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_IMAGE_PAGE. This property is only allowed for PAdES (Baseline or not) signatures.
includeTimestamp- Parameter that indicates if the signature will include a timestamp (true) or not (false).signatureForm- Parameter that represents the signature form. The allowed values for CAdES signature are: The allowed values for CAdES Baseline signature are: The allowed values for XAdES signature are: The allowed values for XAdES Baseline signature are:signaturePolicyID- Parameter that represents the identifier of the signature policy used for generate the signature with signature policies. The identifier must be defined on the properties file where to configure the validation and generation of signatures with signature policies.- Returns:
- an object that represents the generated co-signature.
- Throws:
SigningException- If the method fails.- See Also:
Signer.coSign(byte[], byte[], java.lang.String, java.security.KeyStore.PrivateKeyEntry, java.util.Properties, boolean, java.lang.String, java.lang.String)
-
counterSign
public byte[] counterSign(byte[] signature, java.lang.String algorithm, java.security.KeyStore.PrivateKeyEntry privateKey, java.util.Properties extraParams, boolean includeTimestamp, java.lang.String signatureForm, java.lang.String signaturePolicyID, java.lang.String idClient) throws SigningExceptionMethod that generates a basic counter-signature (signature with signers on serial). This functionality is unsupported for PAdES (Baseline or not) signatures.- Specified by:
counterSignin interfaceSigner- Parameters:
signature- Parameter that represents the original signature.algorithm- Parameter that represents the signature algorithm.privateKey- Parameter that represents the private key of the signing certificate.extraParams- Set of extra configuration parameters. The allowed parameters are:SignatureProperties.CADES_POLICY_QUALIFIER_PROP. This property is only allowed for CAdES (Baseline or not) signatures.SignatureProperties.XADES_CLAIMED_ROLE_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_POLICY_QUALIFIER_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_DESCRIPTION_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_MIME_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_ENCODING_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.PADES_CERTIFICATION_LEVEL. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_CONTACT_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOCATION_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_REASON_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOWER_LEFT_X. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOWER_LEFT_Y. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_UPPER_RIGHT_X. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_UPPER_RIGHT_Y. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_IMAGE. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_IMAGE_PAGE. This property is only allowed for PAdES (Baseline or not) signatures.
includeTimestamp- Parameter that indicates if the signature will include a timestamp (true) or not (false).signatureForm- Parameter that represents the signature form. The allowed values for CAdES signature are: The allowed values for CAdES Baseline signature are: The allowed values for XAdES signature are: The allowed values for XAdES Baseline signature are:signaturePolicyID- Parameter that represents the identifier of the signature policy used for generate the signature with signature policies. The identifier must be defined on the properties file where to configure the validation and generation of signatures with signature policies.idClient- Parameter that represents the client application identifier.- Returns:
- an object that represents the generated counter-signature.
- Throws:
SigningException- If the method fails.- See Also:
Signer.counterSign(byte[], java.lang.String, java.security.KeyStore.PrivateKeyEntry, java.util.Properties, boolean, java.lang.String, java.lang.String, java.lang.String)
-
counterSign
public byte[] counterSign(byte[] signature, java.lang.String algorithm, java.security.KeyStore.PrivateKeyEntry privateKey, java.util.Properties extraParams, boolean includeTimestamp, java.lang.String signatureForm, java.lang.String signaturePolicyID) throws SigningExceptionMethod that generates a basic counter-signature (signature with signers on serial). This functionality is unsupported for PAdES (Baseline or not) signatures.- Specified by:
counterSignin interfaceSigner- Parameters:
signature- Parameter that represents the original signature.algorithm- Parameter that represents the signature algorithm.privateKey- Parameter that represents the private key of the signing certificate.extraParams- Set of extra configuration parameters. The allowed parameters are:SignatureProperties.CADES_POLICY_QUALIFIER_PROP. This property is only allowed for CAdES (Baseline or not) signatures.SignatureProperties.XADES_CLAIMED_ROLE_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_POLICY_QUALIFIER_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_DESCRIPTION_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_MIME_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.XADES_DATA_FORMAT_ENCODING_PROP. This property is only allowed for XAdES (Baseline or not) signatures.SignatureProperties.PADES_CERTIFICATION_LEVEL. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_CONTACT_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOCATION_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_REASON_PROP. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOWER_LEFT_X. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_LOWER_LEFT_Y. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_UPPER_RIGHT_X. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_UPPER_RIGHT_Y. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_IMAGE. This property is only allowed for PAdES (Baseline or not) signatures.SignatureProperties.PADES_IMAGE_PAGE. This property is only allowed for PAdES (Baseline or not) signatures.
includeTimestamp- Parameter that indicates if the signature will include a timestamp (true) or not (false).signatureForm- Parameter that represents the signature form. The allowed values for CAdES signature are: The allowed values for CAdES Baseline signature are: The allowed values for XAdES signature are: The allowed values for XAdES Baseline signature are:signaturePolicyID- Parameter that represents the identifier of the signature policy used for generate the signature with signature policies. The identifier must be defined on the properties file where to configure the validation and generation of signatures with signature policies.- Returns:
- an object that represents the generated counter-signature.
- Throws:
SigningException- If the method fails.- See Also:
Signer.counterSign(byte[], java.lang.String, java.security.KeyStore.PrivateKeyEntry, java.util.Properties, boolean, java.lang.String, java.lang.String)
-
upgrade
public byte[] upgrade(byte[] pdfDocument, java.util.List<java.security.cert.X509Certificate> listSigners, java.lang.String idClient) throws SigningExceptionMethod that upgrades a signature adding a timestamp to all of the signers indicated. If the list of signers is null or empty, the timestamp will be added to all of the signers of the signature. The timestamp will be added only to those signers that don't have a previous timestamp. If the signature has a PDF format this method will add a Document Time-stamp dictionary. If the signature has ASiC-S format the method will upgrade the CAdES or XAdES signature contained inside it.- Specified by:
upgradein interfaceSigner- Parameters:
pdfDocument- Parameter that represents the signature to upgrade.listSigners- Parameter that represents the list of signers of the signature to upgrade with a timestamp. Only for ASN.1 and XML signatures.idClient- Parameter that represents the client application identifier.- Returns:
- the upgraded signature.
- Throws:
SigningException- If the method fails.- See Also:
Signer.upgrade(byte[], java.util.List, java.lang.String)
-
upgrade
public byte[] upgrade(byte[] pdfDocument, java.util.List<java.security.cert.X509Certificate> listSigners) throws SigningExceptionMethod that upgrades a signature adding a timestamp to all of the signers indicated. If the list of signers is null or empty, the timestamp will be added to all of the signers of the signature. The timestamp will be added only to those signers that don't have a previous timestamp. If the signature has a PDF format this method will add a Document Time-stamp dictionary. If the signature has ASiC-S format the method will upgrade the CAdES or XAdES signature contained inside it.- Specified by:
upgradein interfaceSigner- Parameters:
pdfDocument- Parameter that represents the signature to upgrade.listSigners- Parameter that represents the list of signers of the signature to upgrade with a timestamp. Only for ASN.1 and XML signatures.- Returns:
- the upgraded signature.
- Throws:
SigningException- If the method fails.- See Also:
Signer.upgrade(byte[], java.util.List)
-
verifySignature
public PDFValidationResult verifySignature(byte[] pdfDocument)
Method that verifies all the signature dictionaries and document Time-stamp dictionaries of a PDF document.- Parameters:
pdfDocument- Parameter that represents the PDF document.- Returns:
- an object that contains the information about the validation result.
-
getSignedData
public OriginalSignedData getSignedData(byte[] pdfDocument) throws SigningException
Method that obtains the data originally signed from a signature.- Specified by:
getSignedDatain interfaceSigner- Parameters:
pdfDocument- Parameter that represents the signature of which is to obtain the data.- Returns:
- Information about data originally signed.
- Throws:
SigningException- If the metod fails.- See Also:
Signer.getSignedData(byte[])
-
verifySignature
public PDFValidationResult verifySignature(byte[] pdfDocument, java.lang.String idClient)
Method that validates a signed PDF document.- Parameters:
pdfDocument- Parameter that represents the signed PDF document.idClient- Parameter that represents the client application identifier.- Returns:
- an object that contains information about the validation of the signature, including all the signers and counter-signers contained inside it.
-
getValidationDateForSignatureDictionary
public static java.util.Date getValidationDateForSignatureDictionary(CAdESSignerInfo signerInfo, java.lang.Integer signatureDictionaryRevision, java.util.List<PDFDocumentTimestampDictionary> listTimestampDictionaries)
Method that obtains the date to use for validating a signature dictionary.- If the first signed of the signature contained inside of the signature dictionary includes at least one
signature-time-stampattribute, the validation date will be the generation date of the first time-stamp contained inside of thesignature-time-stampattribute. - If the first signed of the signature contained inside of the signature dictionary doesn't include any
signature-time-stampattribute, the validation date will be the generation date of the time-stamp contained inside of the first Document Time-stamp dictionary added after than de signature dictionary. - If the first signed of the signature contained inside of the signature dictionary doesn't include any
signature-time-stampattribute and the PDF document doesn't contain any Document Time-stamp dictionary added after than the signature dictionary, the validation date will be the current date.
- Parameters:
signerInfo- Parameter that represents the information about the first signer of the signature.signatureDictionaryRevision- Parameter that represents the revision number of the signature dictionary.listTimestampDictionaries- Parameter that represents the list with the Document Time-stamp dictionaries contained inside of the PDF document.- Returns:
- the validation date.
- If the first signed of the signature contained inside of the signature dictionary includes at least one
-
-