Class PadesUtils
java.lang.Object
es.juntadeandalucia.afirma.client.util.signatureFormat.PadesUtils
Class .
Project:Horizontal platform of validation services of multiPKI certificates and electronic signature.
- Version:
- 1.0, 11/03/2011.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant attribute that represents the string to identify the value for the key SubFilter of the signature dictionary for a PAdES Enhanced signature.static final StringConstant attribute that represents the string to identify the value for the key SubFilter of a Document Time-stamp dictionary. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanequalsHash(com.itextpdf.text.pdf.PdfArray pdfArrayByteRange, MessageDigest messageDigestSignature, byte[] pdfDocument, byte[] hashSignature) Method that compares two bytes arrays and indicates if the hash of each is equals (true) or not (false).static ObjectgetCMSSignature(byte[] eSignature, com.itextpdf.text.pdf.PdfArray byteRange, byte[] pdfDocument) Method that obtains theSignedDataassociated to a signature in PKCS#7 format.static byte[]getOriginalDocument(com.itextpdf.text.pdf.PdfReader reader) Method that obtains the original bytes from a PDF document.static com.itextpdf.text.pdf.PdfDictionaryobtainLatestSignatureFromPDF(com.itextpdf.text.pdf.PdfReader reader) Method that obtains the signature dictionary with major review.
-
Field Details
-
CADES_SUBFILTER_VALUE
Constant attribute that represents the string to identify the value for the key SubFilter of the signature dictionary for a PAdES Enhanced signature.- See Also:
-
TST_SUBFILTER_VALUE
Constant attribute that represents the string to identify the value for the key SubFilter of a Document Time-stamp dictionary.- See Also:
-
-
Method Details
-
getCMSSignature
public static Object getCMSSignature(byte[] eSignature, com.itextpdf.text.pdf.PdfArray byteRange, byte[] pdfDocument) throws AfirmaException, iaik.cms.CMSParsingException, IOException, NoSuchAlgorithmException, AfirmaException Method that obtains theSignedDataassociated to a signature in PKCS#7 format.- Parameters:
eSignature- Parameter that represents the signature in PKCS#7 format as a bytes array.byteRange- Parameter that represents the contents of the key /ByteArray for the signature in the PDF document.pdfDocument- Parameter that represents the bytes of the original PDF document.- Returns:
- the
SignedDataassociated. - Throws:
AfirmaException- If the method fails.iaik.cms.CMSParsingException- If the method fails.IOException- If the method fails.NoSuchAlgorithmException- If the method fails.AfirmaException- If the method fails.
-
getOriginalDocument
Method that obtains the original bytes from a PDF document.- Parameters:
reader- Parameter that represents the reader object associated to a PDF document.- Returns:
- the original bytes from a PDF document.
- Throws:
IOException
-
obtainLatestSignatureFromPDF
public static com.itextpdf.text.pdf.PdfDictionary obtainLatestSignatureFromPDF(com.itextpdf.text.pdf.PdfReader reader) Method that obtains the signature dictionary with major review.- Parameters:
reader- Parameter that represents the reader for the PDF document.- Returns:
- the signature dictionary with major review.
-
equalsHash
public static boolean equalsHash(com.itextpdf.text.pdf.PdfArray pdfArrayByteRange, MessageDigest messageDigestSignature, byte[] pdfDocument, byte[] hashSignature) Method that compares two bytes arrays and indicates if the hash of each is equals (true) or not (false).- Parameters:
pdfArrayByteRange- Parameter that represents the exact byte range for the digest calculation.messageDigestSignature- Parameter that represents the message digest algorithm.pdfDocument- Parameter that represents the first bytes array to compare.hashSignature- Parameter that represents the second bytes array to compare.- Returns:
- a boolean that indicates if the hash of each is equals (true) or not (false).
-