Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.AcroFields.verifySignature()


        NoCRLException,
        GeneralSecurityException
    {
        // Get all the information about the signature.
        AcroFields fields = reader.getAcroFields();
        PdfPKCS7 pkcs7 = fields.verifySignature(signature);

        // Use the signature to check the document integrity.
        if (!pkcs7.verify()) {
            throw new InvalidSignatureException(
                String.format(messages.getString(
View Full Code Here


        Map<String, PdfPKCS7> result = new LinkedHashMap<String, PdfPKCS7>();

        // Get signature data encoded in PKCS #7 format for each signature.
        for (String signature : signatures) {
            // Verify the signature.
            PdfPKCS7 pkcs7 = fields.verifySignature(signature);

            // Check if the signature is a document level timestamp.
            if (pkcs7.isTsp() && !includeTimestamps) {
                // Skip document level timestamps.
                continue;
View Full Code Here

                "Document_has_no_signature."));
        }

        // Check if the last signature is a timestamp.
        String lastSignature = signatures.get(signatures.size() - 1);
        PdfPKCS7 pkcs7 = fields.verifySignature(lastSignature);
        if (pkcs7.isTsp()) {
            // Prepare to store certificates, OCSP responses and CRLs only for the last timestamp.
            signatures.clear();
            signatures.add(lastSignature);
        }
View Full Code Here

        HashMap<String, ArrayList<BasicOCSPResp>> ocspMap = new HashMap<String, ArrayList<BasicOCSPResp>>();

        // Store certificates, OCSP responses and CRLs for each signature.
        for (String signature : signatures) {
            // Get signature data.
            pkcs7 = fields.verifySignature(signature);

            // Get certificate path.
            X509Certificate signingCertificate = (X509Certificate) factory.generateCertificate(
                new ByteArrayInputStream(pkcs7.getSigningCertificate().getEncoded()));
            Certificate[] chain = pkcs7.getSignCertificateChain();
View Full Code Here

                "Document_has_no_signature."));
        }

        // Check if the last signature is a timestamp.
        String lastSignature = signatures.get(signatures.size() - 1);
        PdfPKCS7 pkcs7 = fields.verifySignature(lastSignature);
        if (!pkcs7.isTsp()) {
            throw new NoTimestampException(messages.getString(
                "Document_has_no_document_level_timestamp."));
        }
View Full Code Here

        Calendar date = pkcs7.getTimeStampDate();

        // Validate others signatures using date of the timestamp.
        for (int i = signatures.size() - 2; i >= 0; i--) {
            // Get next signature.
            pkcs7 = fields.verifySignature(signatures.get(i));

            // Validate next signature.
            SignatureValidator.validate(
                signatures.get(i), reader, rootCertificates, ocsps, crls, date);
View Full Code Here

      Collection<Signature> signatures = new ArrayList<Signature>();
      if (fields != null) {
        List<String> list = fields.getSignatureNames();
        if ((list != null) && (!list.isEmpty())) {
          for (String str : list) {
            PdfPKCS7 pk = fields.verifySignature(str);

            PdfString string = fields.getSignatureDictionary(str).getAsString(PdfName.CONTENTS);
            byte[] content = string.getBytes();

            X509Certificate certificate = pk.getSigningCertificate();
View Full Code Here

      Collection<Signature> signatures = new ArrayList<Signature>();
      if (fields != null) {
        List<String> list = fields.getSignatureNames();
        if ((list != null) && (!list.isEmpty())) {
          for (String str : list) {
            PdfPKCS7 pk = fields.verifySignature(str);

            PdfString string = fields.getSignatureDictionary(str).getAsString(PdfName.CONTENTS);
            byte[] content = string.getBytes();

            X509Certificate certificate = pk.getSigningCertificate();
View Full Code Here

      Collection<Signature> signatures = new ArrayList<Signature>();
      if (fields != null) {
        List<String> list = fields.getSignatureNames();
        if ((list != null) && (!list.isEmpty())) {
          for (String str : list) {
            PdfPKCS7 pk = fields.verifySignature(str);

            PdfString string = fields.getSignatureDictionary(str).getAsString(PdfName.CONTENTS);
            byte[] content = string.getBytes();

            X509Certificate certificate = pk.getSigningCertificate();
View Full Code Here

      Collection<Signature> signatures = new ArrayList<Signature>();
      if (fields != null) {
        List<String> list = fields.getSignatureNames();
        if ((list != null) && (!list.isEmpty())) {
          for (String str : list) {
            PdfPKCS7 pk = fields.verifySignature(str);

            PdfString string = fields.getSignatureDictionary(str).getAsString(PdfName.CONTENTS);
            byte[] content = string.getBytes();

            X509Certificate certificate = pk.getSigningCertificate();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.