Package es.gob.afirma.signature.cades
Class CAdESBaselineSigner
- java.lang.Object
-
- es.gob.afirma.signature.cades.CAdESBaselineSigner
-
- All Implemented Interfaces:
Signer
public final class CAdESBaselineSigner extends java.lang.Object implements Signer
Class that manages the generation, validation and upgrade of CAdES Baseline signatures.
Project:Library for the integration with the services of @Firma, eVisor and TS@.
- Version:
- 1.8, 18/04/2022.
-
-
Constructor Summary
Constructors Constructor Description CAdESBaselineSigner()Constructor method for the class CAdESBaselineSigner.java.
-
Method Summary
All 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[] signature)Method that obtains the data originally signed from a 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)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[] signature, java.util.List<java.security.cert.X509Certificate> listCertificates)Method that upgrades a signature adding a timestamp to all of the signers indicated.byte[]upgrade(byte[] signature, java.util.List<java.security.cert.X509Certificate> listCertificates, java.lang.String idClient)Method that upgrades a signature adding a timestamp to all of the signers indicated.voidvalidateCounterSigners(CAdESSignerInfo signerInfo, SignerValidationResult signerValidationResult, org.bouncycastle.cms.CMSSignedData signedData, ValidationResult validationResult, java.lang.String idClient)Method that validates all the counter-signers associated to a signer.SignerValidationResultvalidateSigner(org.bouncycastle.cms.CMSSignedData signedData, CAdESSignerInfo signerInfo, ValidationResult validationResult, java.lang.String idClient, boolean isCounterSignature, java.lang.String signerFormat)Method that validates a signer/counter-signer of a signature.ValidationResultverifySignature(byte[] eSignature, byte[] document)Method that validates the signers of a CAdES signature.ValidationResultverifySignature(byte[] eSignature, byte[] document, java.lang.String idClient)Method that validates a CAdES Baseline signature.
-
-
-
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[] signature, java.util.List<java.security.cert.X509Certificate> listCertificates, 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:
signature- Parameter that represents the signature to upgrade.listCertificates- 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[] signature, java.util.List<java.security.cert.X509Certificate> listCertificates) 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:
signature- Parameter that represents the signature to upgrade.listCertificates- 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 ValidationResult verifySignature(byte[] eSignature, byte[] document)
Method that validates the signers of a CAdES signature.- Parameters:
eSignature- Parameter that represents the signature to validate.document- Parameter that represents the original document signed by the signature.- Returns:
- an object that contains the information about the validation result.
-
getSignedData
public OriginalSignedData getSignedData(byte[] signature) throws SigningException
Method that obtains the data originally signed from a signature.- Specified by:
getSignedDatain interfaceSigner- Parameters:
signature- 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 ValidationResult verifySignature(byte[] eSignature, byte[] document, java.lang.String idClient)
Method that validates a CAdES Baseline signature.- Parameters:
eSignature- Parameter that represents the signature to validate.document- Parameter that represents the original data. This parameter is required if the signature is explicit.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.
-
validateSigner
public SignerValidationResult validateSigner(org.bouncycastle.cms.CMSSignedData signedData, CAdESSignerInfo signerInfo, ValidationResult validationResult, java.lang.String idClient, boolean isCounterSignature, java.lang.String signerFormat)
Method that validates a signer/counter-signer of a signature.- Parameters:
signedData- Parameter that represents the signature message.signerInfo- Parameter that represents the information about the signer.validationResult- Parameter that represents the information about the validation of the signature.idClient- Parameter that represents the client application identifier.isCounterSignature- Parameter that indicates if the element to validate is a signer (false) or a counter-signer (true).signerFormat- Parameter that represents the format associated to the signer/counter-signer.- Returns:
- an object that represents the validation information about the signer/counter-signer.
-
validateCounterSigners
public void validateCounterSigners(CAdESSignerInfo signerInfo, SignerValidationResult signerValidationResult, org.bouncycastle.cms.CMSSignedData signedData, ValidationResult validationResult, java.lang.String idClient)
Method that validates all the counter-signers associated to a signer.- Parameters:
signerInfo- Parameter that represents the information about the parent signer.signerValidationResult- Parameter that represents the information about the validation of the parent signer.signedData- Parameter that represents the signature message.validationResult- Parameter that represents the information about the validation of the signature.idClient- Parameter that represents the client application identifier.
-
-