Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfSignature


                estimatedSize += 4192;
            if (tsaClient != null)
                estimatedSize += 4192;
        }
        sap.setCertificate(chain[0]);
        PdfSignature dic = new PdfSignature(PdfName.ADOBE_PPKLITE, sigtype == CryptoStandard.CADES ? PdfName.ETSI_CADES_DETACHED : PdfName.ADBE_PKCS7_DETACHED);
        dic.setReason(sap.getReason());
        dic.setLocation(sap.getLocation());
        dic.setContact(sap.getContact());
        dic.setDate(new PdfDate(sap.getSignDate())); // time-stamp will over-rule this
        sap.setCryptoDictionary(dic);

        HashMap<PdfName, Integer> exc = new HashMap<PdfName, Integer>();
        exc.put(PdfName.CONTENTS, new Integer(estimatedSize * 2 + 2));
        sap.preClose(exc);
View Full Code Here


     */
    public static void timestamp(PdfSignatureAppearance sap, TSAClient tsa, String signatureName) throws IOException, DocumentException, GeneralSecurityException {
        int contentEstimated = tsa.getTokenSizeEstimate();
        sap.setVisibleSignature(new Rectangle(0,0,0,0), 1, signatureName);

        PdfSignature dic = new PdfSignature(PdfName.ADOBE_PPKLITE, PdfName.ETSI_RFC3161);
        dic.put(PdfName.TYPE, PdfName.DOCTIMESTAMP);
        sap.setCryptoDictionary(dic);

        HashMap<PdfName,Integer> exc = new HashMap<PdfName,Integer>();
        exc.put(PdfName.CONTENTS, new Integer(contentEstimated * 2 + 2));
        sap.preClose(exc);
View Full Code Here

    public static void timestamp(PdfSignatureAppearance sap, TSAClient tsa, String signatureName) throws IOException, DocumentException, GeneralSecurityException {
        int contentEstimated = tsa.getTokenSizeEstimate();
        sap.addDeveloperExtension(PdfDeveloperExtension.ESIC_1_7_EXTENSIONLEVEL5);
        sap.setVisibleSignature(new Rectangle(0,0,0,0), 1, signatureName);

        PdfSignature dic = new PdfSignature(PdfName.ADOBE_PPKLITE, PdfName.ETSI_RFC3161);
        dic.put(PdfName.TYPE, PdfName.DOCTIMESTAMP);
        sap.setCryptoDictionary(dic);

        HashMap<PdfName,Integer> exc = new HashMap<PdfName,Integer>();
        exc.put(PdfName.CONTENTS, new Integer(contentEstimated * 2 + 2));
        sap.preClose(exc);
View Full Code Here

        }
        sap.setCertificate(chain[0]);
        if (sigtype == CryptoStandard.CADES) {
          sap.addDeveloperExtension(PdfDeveloperExtension.ESIC_1_7_EXTENSIONLEVEL2);
        }
        PdfSignature dic = new PdfSignature(PdfName.ADOBE_PPKLITE, sigtype == CryptoStandard.CADES ? PdfName.ETSI_CADES_DETACHED : PdfName.ADBE_PKCS7_DETACHED);
        dic.setReason(sap.getReason());
        dic.setLocation(sap.getLocation());
        dic.setSignatureCreator(sap.getSignatureCreator());
        dic.setContact(sap.getContact());
        dic.setDate(new PdfDate(sap.getSignDate())); // time-stamp will over-rule this
        sap.setCryptoDictionary(dic);

        HashMap<PdfName, Integer> exc = new HashMap<PdfName, Integer>();
        exc.put(PdfName.CONTENTS, new Integer(estimatedSize * 2 + 2));
        sap.preClose(exc);
View Full Code Here

     * @throws GeneralSecurityException
     * @throws IOException
     * @throws DocumentException
     */
    public static void signExternalContainer(PdfSignatureAppearance sap, ExternalSignatureContainer externalSignatureContainer, int estimatedSize) throws GeneralSecurityException, IOException, DocumentException {
        PdfSignature dic = new PdfSignature(null, null);
        dic.setReason(sap.getReason());
        dic.setLocation(sap.getLocation());
        dic.setSignatureCreator(sap.getSignatureCreator());
        dic.setContact(sap.getContact());
        dic.setDate(new PdfDate(sap.getSignDate())); // time-stamp will over-rule this
        externalSignatureContainer.modifySigningDictionary(dic);
        sap.setCryptoDictionary(dic);

        HashMap<PdfName, Integer> exc = new HashMap<PdfName, Integer>();
        exc.put(PdfName.CONTENTS, new Integer(estimatedSize * 2 + 2));
View Full Code Here

        appearance.setReason(this.parameters.getSignatureInfo().getReason());
      }

      appearance.setSignDate(calendar);

      PdfSignature signature = new PdfSignature(PdfName.ADOBE_PPKLITE, PdfName.ADBE_PKCS7_DETACHED);
      signature.setReason(appearance.getReason());
      signature.setLocation(appearance.getLocation());
      signature.setContact(appearance.getContact());
      signature.setDate(new PdfDate(appearance.getSignDate()));

      if ((this.parameters.getSignatureInfo() != null) && (Conditions.isNotEmpty(this.parameters.getSignatureInfo().getName()))) {
        signature.setName(this.parameters.getSignatureInfo().getName());
      } else {
        signature.setName(BouncyCastleProviderHelper.toString(certificate.getSubjectX500Principal()));
      }

      appearance.setCryptoDictionary(signature);

      String providerName = null;
View Full Code Here

      appearance.setContact(this.request.getContactInfo());
      appearance.setLocation(this.request.getLocation());
      appearance.setReason(this.request.getReason());
      appearance.setSignDate(calendar);

      PdfSignature signature = new PdfSignature(PdfName.ADOBE_PPKLITE, PdfName.ADBE_PKCS7_DETACHED);
      signature.setReason(appearance.getReason());
      signature.setLocation(appearance.getLocation());
      signature.setContact(appearance.getContact());
      signature.setDate(new PdfDate(appearance.getSignDate()));

      if (ConditionUtils.isNotEmpty(this.request.getName())) {
        signature.setName(this.request.getName());
      } else {
        signature.setName(this.getValue(certificate.getSubjectX500Principal()));
      }

      appearance.setCryptoDictionary(signature);

      int contentSize = 0x2502;
View Full Code Here

      appearance.setContact(this.parameters.getContactInfo());
      appearance.setLocation(this.parameters.getLocation());
      appearance.setReason(this.parameters.getReason());
      appearance.setSignDate(calendar);

      PdfSignature signature = new PdfSignature(PdfName.ADOBE_PPKLITE, PdfName.ADBE_PKCS7_DETACHED);
      signature.setReason(appearance.getReason());
      signature.setLocation(appearance.getLocation());
      signature.setContact(appearance.getContact());
      signature.setDate(new PdfDate(appearance.getSignDate()));

      if (ConditionUtils.isNotEmpty(this.parameters.getName())) {
        signature.setName(this.parameters.getName());
      } else {
        signature.setName(BouncyCastleProviderHelper.getName(certificate.getSubjectX500Principal()));
      }

      appearance.setCryptoDictionary(signature);

      int contentSize = 0x2502;
View Full Code Here

        appearance.setReason(this.parameters.getSignatureInfo().getReason());
      }

      appearance.setSignDate(calendar);

      PdfSignature signature = new PdfSignature(PdfName.ADOBE_PPKLITE, PdfName.ADBE_PKCS7_DETACHED);
      signature.setReason(appearance.getReason());
      signature.setLocation(appearance.getLocation());
      signature.setContact(appearance.getContact());
      signature.setDate(new PdfDate(appearance.getSignDate()));

      if ((this.parameters.getSignatureInfo() != null) && (ConditionUtils.isNotEmpty(this.parameters.getSignatureInfo().getName()))) {
        signature.setName(this.parameters.getSignatureInfo().getName());
      } else {
        signature.setName(BouncyCastleProviderHelper.toString(certificate.getSubjectX500Principal()));
      }

      appearance.setCryptoDictionary(signature);

      String providerName = null;
View Full Code Here

      appearance.setContact(this.parameters.getContactInfo());
      appearance.setLocation(this.parameters.getLocation());
      appearance.setReason(this.parameters.getReason());
      appearance.setSignDate(calendar);

      PdfSignature signature = new PdfSignature(PdfName.ADOBE_PPKLITE, PdfName.ADBE_PKCS7_DETACHED);
      signature.setReason(appearance.getReason());
      signature.setLocation(appearance.getLocation());
      signature.setContact(appearance.getContact());
      signature.setDate(new PdfDate(appearance.getSignDate()));

      if (ConditionUtils.isNotEmpty(this.parameters.getName())) {
        signature.setName(this.parameters.getName());
      } else {
        signature.setName(BouncyCastleProviderHelper.getName(certificate.getSubjectX500Principal()));
      }

      appearance.setCryptoDictionary(signature);

      int contentSize = 0x2502;
View Full Code Here

TOP

Related Classes of com.itextpdf.text.pdf.PdfSignature

Copyright © 2018 www.massapicom. 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.