Class PDFFormatDetector
java.lang.Object
es.juntadeandalucia.afirma.client.util.signatureFormat.PDFFormatDetector
- All Implemented Interfaces:
SpecificFormatDetectorI
Class that represents a format checker for signatures on PDF documents.
Project:Horizontal platform of validation services of multiPKI certificates and electronic signature.
- Version:
- 1.0, 25/04/2011.
-
Field Summary
Fields inherited from interface es.juntadeandalucia.afirma.client.util.signatureFormat.SpecificFormatDetectorI
ARCHIVE_TIME_STAMP_ELEMENT, ARCHIVE_TIME_STAMP_OID, ARCHIVE_TIME_STAMP_V2_OID, CADES_A_FORMAT, CADES_BASIC_FORMAT, CADES_BES_FORMAT, CADES_C_FORMAT, CADES_C_TIME_STAMP_OID, CADES_C_TIME_STAMPED_CERTS_CRLS_REFERENCES_OID, CADES_EPES_FORMAT, CADES_T_FORMAT, CADES_X_LONG_FORMAT, CADES_X_LONG_TYPE1_FORMAT, CADES_X_LONG_TYPE2_FORMAT, CADES_X_TYPE1_FORMAT, CADES_X_TYPE2_FORMAT, CERTIFICATE_VALUES_ELEMENT, CERTIFICATE_VALUES_OID, CMS_BASIC_FORMAT, CMS_BES_FORMAT, CMS_T_FORMAT, COMPLETE_CERTIFICATE_REFERENCES_OID, COMPLETE_CERTIFICATE_REFS_ELEMENT, COMPLETE_REVOCATION_REFERENCES_OID, COMPLETE_REVOCATION_REFS_ELEMENT, NONE_FORMAT, OBJECT_ELEMENT, ODF_BASIC_FORMAT, ODF_FORMAT, ODT_T_FORMAT, OTHER_SIGNING_CERTIFICATE_OID, PADES_BASIC_FORMAT, PADES_BES_FORMAT, PDF_BASIC_FORMAT, PDF_FORMAT, PKCS7_BASIC_FORMAT, PKCS7_FORMAT, QUALIFYING_PROPERTIES_ELEMENT, REFS_ONLY_TIME_STAMP_ELEMENT, REVOCATION_VALUES_ELEMENT, REVOCATION_VALUES_OID, SIG_AND_REFS_TIME_STAMP_ELEMENT, SIGNATURE_METHOD, SIGNATURE_POLICY_ID_ELEMENT, SIGNATURE_POLICY_IDENTIFIER_ELEMENT, SIGNATURE_POLICY_IDENTIFIER_OID, SIGNATURE_PROPERTIES_ELEMENT, SIGNATURE_PROPERTY_ELEMENT, SIGNATURE_TIME_STAMP_ELEMENT, SIGNATURE_TIME_STAMP_OID, SIGNED_PROPERTIES_ELEMENT, SIGNED_SIGNATURE_PROPERTIES_ELEMENT, SIGNING_CERTIFICATE_OID, SIGNING_CERTIFICATE_V2_OID, SMIME_BASIC_FORMAT, SMIME_FORMAT, SMIME_T_FORMAT, UNSIGNED_PROPERTIES_ELEMENT, UNSIGNED_SIGNATURE_PROPERTIES_ELEMENT, XADES_A_FORMAT, XADES_BASIC_FORMAT, XADES_BES_FORMAT, XADES_C_FORMAT, XADES_EPES_FORMAT, XADES_T_FORMAT, XADES_X1_FORMAT, XADES_X2_FORMAT, XADES_XL_FORMAT, XADES_XL1_FORMAT, XADES_XL2_FORMAT, XMLDSIG_BASIC_FORMAT, XMLDSIG_FORMAT, XMLNS, XMLNS_XADES_111, XMLNS_XADES_122, XMLNS_XADES_132 -
Constructor Summary
ConstructorsConstructorDescriptionPDFFormatDetector(com.itextpdf.text.pdf.PdfReader rd) Constructor method for the class PDFFormatDetector.java.PDFFormatDetector(Object sig) Constructor method for the class PDFFormatDetector.java. -
Method Summary
Modifier and TypeMethodDescriptionMétodo que devuelve el formato básico de la firma electrónica detectado hasta el momento.Método que devuelve el formato específico de la firma electrónica detectado hasta el momento.booleanisA()Métodos para comprobar si la firma contiene los atributos no firmados del formato A.booleanisBES()Métodos para comprobar si la firma contiene los atributos firmados del formato BES.booleanisBES(com.itextpdf.text.pdf.PdfDictionary pdfDic) Method that indicates if a signature dictionary refers to a PAdES-BES signature (true) or not (false)booleanisC()Métodos para comprobar si la firma contiene los atributos no firmados del formato C.booleanisEPES()Métodos para comprobar si la firma contiene los atributos firmados del formato EPES.booleanMethod that indicates if the most advanced signature in a PDF document is a PAdES-Basic signature (true) or not (false).booleanisPAdESBasic(com.itextpdf.text.pdf.PdfDictionary pdfDic) Method that indicates if a signature dictionary refers to a PAdES-Basic signature (true) or not (false).booleanisPDF()Method that indicates if the signature of a PDF document is a PDF signature, i.e., any of the signature of the PDF document is a PAdES signature.booleanisPDF(com.itextpdf.text.pdf.PdfDictionary pdfDic) Method that indicates if a signature dictionary refers to a PDF signature (non PAdES signature) (true) or not (false).booleanisSignatureFormatUpperOrEqualThanTheFormat(String signatureFormat, String formatToTest) Method that indicates whether the signature format contained in signatureFormat input parameter is equal or more advanced than indicated in formatToTest.booleanisSignatureFormatUpperThanTheFormat(String signatureFormat, String formatToTest) Method that indicates whether the signature format contained in signatureFormat input parameter is more advanced than indicated in formatToTest.booleanisT()Métodos para comprobar si la firma contiene los atributos no firmados del formato T.booleanisX1()Métodos para comprobar si la firma contiene los atributos no firmados del formato X Type1.booleanisX1L()Métodos para comprobar si la firma contiene los atributos no firmados del formato X Long Type1.booleanisX2()Métodos para comprobar si la firma contiene los atributos no firmados del formato X Type2.booleanisX2L()Métodos para comprobar si la firma contiene los atributos no firmados del formato X Long Type2.booleanisXL()Métodos para comprobar si la firma contiene los atributos no firmados del formato X Long.Método que resuelve el formato básico de una firma electrónica con formato desconocido.Método que resuelve el formato extendido de una firma electrónica con formato desconocido.
-
Constructor Details
-
PDFFormatDetector
Constructor method for the class PDFFormatDetector.java.- Parameters:
sig- Parameter that allows to access to the fields in a PDF document.- Throws:
AfirmaException- If the method fails.
-
PDFFormatDetector
Constructor method for the class PDFFormatDetector.java.- Parameters:
rd- Parameter that allows to access to the fields in a PDF document.- Throws:
AfirmaException- If the method fails.
-
-
Method Details
-
isBES
public boolean isBES()Métodos para comprobar si la firma contiene los atributos firmados del formato BES.- Specified by:
isBESin interfaceSpecificFormatDetectorI- Returns:
- boolean, true si contiene los elementos del formato BES. false si no contiene los elementos del formato BES.
- See Also:
-
isBES
public boolean isBES(com.itextpdf.text.pdf.PdfDictionary pdfDic) Method that indicates if a signature dictionary refers to a PAdES-BES signature (true) or not (false)- Parameters:
pdfDic- Parameter that represents the signature dictionary.- Returns:
- a boolean that indicates if a signature dictionary refers to a PAdES-BES signature (true) or not (false)
-
isEPES
public boolean isEPES()Métodos para comprobar si la firma contiene los atributos firmados del formato EPES.- Specified by:
isEPESin interfaceSpecificFormatDetectorI- Returns:
- boolean, true si contiene los elementos del formato EPES. false si no contiene los elementos del formato EPEs.
- See Also:
-
isT
public boolean isT()Métodos para comprobar si la firma contiene los atributos no firmados del formato T.- Specified by:
isTin interfaceSpecificFormatDetectorI- Returns:
- boolean, true si contiene los elementos del formato T. false si no contiene los elementos del formato T.
- See Also:
-
isC
public boolean isC()Métodos para comprobar si la firma contiene los atributos no firmados del formato C.- Specified by:
isCin interfaceSpecificFormatDetectorI- Returns:
- boolean, true si contiene los elementos del formato C. false si no contiene los elementos del formato C.
- See Also:
-
isX1
public boolean isX1()Métodos para comprobar si la firma contiene los atributos no firmados del formato X Type1.- Specified by:
isX1in interfaceSpecificFormatDetectorI- Returns:
- boolean, true si contiene los elementos del formato X Type1. false si no contiene los elementos del formato X Type1.
- See Also:
-
isX2
public boolean isX2()Métodos para comprobar si la firma contiene los atributos no firmados del formato X Type2.- Specified by:
isX2in interfaceSpecificFormatDetectorI- Returns:
- boolean, true si contiene los elementos del formato X Type2. false si no contiene los elementos del formato X Type2.
- See Also:
-
isXL
public boolean isXL()Métodos para comprobar si la firma contiene los atributos no firmados del formato X Long.- Specified by:
isXLin interfaceSpecificFormatDetectorI- Returns:
- boolean, true si contiene los elementos del formato X Long. false si no contiene los elementos del formato X Long.
- See Also:
-
isX1L
public boolean isX1L()Métodos para comprobar si la firma contiene los atributos no firmados del formato X Long Type1.- Specified by:
isX1Lin interfaceSpecificFormatDetectorI- Returns:
- boolean, true si contiene los elementos del formato X Long Type1. false si no contiene los elementos del formato X Long Type1.
- See Also:
-
isX2L
public boolean isX2L()Métodos para comprobar si la firma contiene los atributos no firmados del formato X Long Type2.- Specified by:
isX2Lin interfaceSpecificFormatDetectorI- Returns:
- boolean, true si contiene los elementos del formato X Long Type2. false si no contiene los elementos del formato X Long type2.
- See Also:
-
isA
public boolean isA()Métodos para comprobar si la firma contiene los atributos no firmados del formato A.- Specified by:
isAin interfaceSpecificFormatDetectorI- Returns:
- boolean, true si contiene los elementos del formato A. false si no contiene los elementos del formato A.
- See Also:
-
getBasicFormat
Método que devuelve el formato básico de la firma electrónica detectado hasta el momento.- Specified by:
getBasicFormatin interfaceSpecificFormatDetectorI- Returns:
- String, Devuelve el formato de la firma de entre los formatos básicos definidos en esta interfaz.
- See Also:
-
getSpecificFormat
Método que devuelve el formato específico de la firma electrónica detectado hasta el momento.- Specified by:
getSpecificFormatin interfaceSpecificFormatDetectorI- Returns:
- String, Devuelve el formato de la firma de entre los formatos específicos definidos en esta interfaz.
- See Also:
-
resolveBasicFormat
Método que resuelve el formato básico de una firma electrónica con formato desconocido.Este método se ejecuta automaticamente al crear el objeto con el siguiente constructor:
new XXXFormatDetector(Object sig)
Para otros constructores será necesario invocar el método para hallar el formato básico.
- Specified by:
resolveBasicFormatin interfaceSpecificFormatDetectorI- Returns:
- String, Devuelve el formato básico de la firma de entre los formatos BES definidos en esta interfaz.
- See Also:
-
resolveSignatureFormat
Método que resuelve el formato extendido de una firma electrónica con formato desconocido.- Specified by:
resolveSignatureFormatin interfaceSpecificFormatDetectorI- Returns:
- String, Devuelve el formato extendido de la firma de entre los formatos definidos en esta interfaz.
- See Also:
-
isSignatureFormatUpperThanTheFormat
Method that indicates whether the signature format contained in signatureFormat input parameter is more advanced than indicated in formatToTest.- Specified by:
isSignatureFormatUpperThanTheFormatin interfaceSpecificFormatDetectorI- Parameters:
signatureFormat- Signature format you want to check if it is more advanced.formatToTest- Signature format taking as a basis for comparison.- Returns:
trueif the indicated signature format is more advanced than the taking as a basis for comparison.falseotherwise.- See Also:
-
isSignatureFormatUpperOrEqualThanTheFormat
public boolean isSignatureFormatUpperOrEqualThanTheFormat(String signatureFormat, String formatToTest) Method that indicates whether the signature format contained in signatureFormat input parameter is equal or more advanced than indicated in formatToTest.- Specified by:
isSignatureFormatUpperOrEqualThanTheFormatin interfaceSpecificFormatDetectorI- Parameters:
signatureFormat- Signature format you want to check if it is equal or more advanced.formatToTest- Signature format taking as a basis for comparison.- Returns:
trueif the indicated signature format is equal or more advanced than the taking as a basis for comparison.falseotherwise.- See Also:
-
isPDF
public boolean isPDF(com.itextpdf.text.pdf.PdfDictionary pdfDic) Method that indicates if a signature dictionary refers to a PDF signature (non PAdES signature) (true) or not (false).- Parameters:
pdfDic- Parameter that represents the signature dictionary.- Returns:
- a boolean that indicates if a signature dictionary refers to a PDF signature (non PAdES signature) (true) or not (false).
-
isPDF
public boolean isPDF()Method that indicates if the signature of a PDF document is a PDF signature, i.e., any of the signature of the PDF document is a PAdES signature.- Returns:
- a boolean that indicates if the signature of a PDF document is a PDF signature, i.e., any of the signature of the PDF document is a PAdES signature.
-
isPAdESBasic
public boolean isPAdESBasic(com.itextpdf.text.pdf.PdfDictionary pdfDic) Method that indicates if a signature dictionary refers to a PAdES-Basic signature (true) or not (false).- Parameters:
pdfDic- Parameter that represents the signature dictionary.- Returns:
- a boolean that indicates if a signature dictionary refers to a PAdES-Basic signature (true) or not (false)
-
isPAdESBasic
public boolean isPAdESBasic()Method that indicates if the most advanced signature in a PDF document is a PAdES-Basic signature (true) or not (false).- Returns:
- a boolean that indicates if the most advanced signature in a PDF document is a PAdES-Basic signature (true) or not (false).
-
getDigestAlgorithmImplementation
- Specified by:
getDigestAlgorithmImplementationin interfaceSpecificFormatDetectorI- Throws:
NoSuchAlgorithmException
-