Package es.gob.afirma.signature.xades
Class XAdESBaselineSigner
- java.lang.Object
-
- es.gob.afirma.signature.xades.XAdESBaselineSigner
-
- All Implemented Interfaces:
Signer
public final class XAdESBaselineSigner extends java.lang.Object implements Signer
Class that manages the generation, validation and upgrade of XAdES Baseline signatures.
Project:Library for the integration with the services of @Firma, eVisor and TS@.
- Version:
- 1.10, 18/04/2022.
-
-
Constructor Summary
Constructors Constructor Description XAdESBaselineSigner()Constructor method for the class XAdESBaselineSigner.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[] data)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, boolean asicsSignature, java.lang.String signedFileName)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> listSignersToUpdate)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> listSignersToUpdate, java.lang.String idClient)Method that upgrades a signature adding a timestamp to all of the signers indicated.voidvalidateCounterSigners(java.lang.String signingMode, XAdESSignerInfo signerInfo, SignerValidationResult signerValidationResult, ValidationResult validationResult, java.lang.String idClient, byte[] signedFile, java.lang.String signedFileName)Method that validates all the counter-signers associated to a signer.SignerValidationResultvalidateSigner(java.lang.String signingMode, XAdESSignerInfo signerInfo, ValidationResult validationResult, java.lang.String idClient, java.lang.String signerFormat, boolean isCounterSignature, byte[] signedFile, java.lang.String signedFileName)Method that validates a signer/counter-signer of a XML signature.ValidationResultverifySignature(byte[] xmlDocument)Method that validates the signers of a XAdES signature.ValidationResultverifySignature(byte[] xmlDocument, java.lang.String idClient)Method that validates a signed XML 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)
-
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, boolean asicsSignature, java.lang.String signedFileName) throws SigningException
-
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> listSignersToUpdate, 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.listSignersToUpdate- 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> listSignersToUpdate) 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.listSignersToUpdate- 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[] xmlDocument)
Method that validates the signers of a XAdES signature.- Parameters:
xmlDocument- Parameter that represents the XAdES signature.- Returns:
- an object that contains the information about the validation result.
-
getSignedData
public OriginalSignedData getSignedData(byte[] data) throws SigningException
Method that obtains the data originally signed from a signature.- Specified by:
getSignedDatain interfaceSigner- Parameters:
data- 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[] xmlDocument, java.lang.String idClient)
Method that validates a signed XML document.- Parameters:
xmlDocument- Parameter that represents the signed XML document.idClient- Parameter that represents the client application identifier.- Returns:
- an object that contains information about the validation of the signed XML document, including all the signers and counter-signers contained inside it.
-
validateSigner
public SignerValidationResult validateSigner(java.lang.String signingMode, XAdESSignerInfo signerInfo, ValidationResult validationResult, java.lang.String idClient, java.lang.String signerFormat, boolean isCounterSignature, byte[] signedFile, java.lang.String signedFileName)
Method that validates a signer/counter-signer of a XML signature.- Parameters:
signingMode- Parameter that represents the signing mode of the signed XML document. The possible values are:signerInfo- Parameter that represents the information about the signer.validationResult- Parameter that represents the information about the validation of the signed XML document.idClient- Parameter that represents the client application identifier.signerFormat- Parameter that represents the format associated to the signer/counter-signer.isCounterSignature- Parameter that indicates if the element to validate is a signer (false) or a counter-signer (true).signedFile- Parameter that represents the file signed by the XML signature when the signed data isn't included into the signed XML document.signedFileName- Parameter that represents the name of the file signed by the XML signature when the signed data isn't included into the signed XML document.- Returns:
- an object that represents the validation information about the signer/counter-signer.
-
validateCounterSigners
public void validateCounterSigners(java.lang.String signingMode, XAdESSignerInfo signerInfo, SignerValidationResult signerValidationResult, ValidationResult validationResult, java.lang.String idClient, byte[] signedFile, java.lang.String signedFileName)Method that validates all the counter-signers associated to a signer.- Parameters:
signingMode- Parameter that represents the signing mode of the signed XML document. The possible values are:signerInfo- Parameter that represents the information about the parent signer.signerValidationResult- Parameter that represents the information about the validation of the parent signer.validationResult- Parameter that represents the information about the validation of the signature.idClient- Parameter that represents the client application identifier.signedFile- Parameter that represents the file signed by the XML signature when the signed data isn't included into the signed XML document.signedFileName- Parameter that represents the name of the file signed by the XML signature when the signed data isn't included into the signed XML document.
-
-