title: how can I add PAdES-LTV using iText
body: <p>I am trying to enable LTV in an already signed PDF document without LTV format. I have found the same example in all cases as described in the links <a href="https://developers.itextpdf.com/question/how-enable-ltv-timestamp-signature" rel="nofollow noreferrer">How to enable LTV for a timestamp signature</a>, <a href="https://stackoverflow.com/questions/35134568/itext-ltv-enabled-how-to-add-more-crls">iText LTV enabled - how to add more CRLs?
  </a>, which, defines what is the procedure to obtain the expected result. It happens that I'm not working, it does not give me any error but I do not add the LTV.</p>
  
  <p>Some idea of why at the time of executing the following code does not give me any error but nevertheless I do not add the LTV.</p>
  
  <p>This is the method with which I am trying to add the LTV: </p>
  
  <pre><code>public void addLtv(String src, String dest, OcspClient ocsp, CrlClient crl, TSAClient tsa)
      throws IOException, DocumentException, GeneralSecurityException {
      PdfReader r = new PdfReader(src);
      FileOutputStream fos = new FileOutputStream(dest);
      PdfStamper stp = PdfStamper.createSignature(r, fos, '\0', null, true);
      LtvVerification v = stp.getLtvVerification();
      AcroFields fields = stp.getAcroFields();
      List&lt;String&gt; names = fields.getSignatureNames();
      String sigName = names.get(names.size() - 1);
      PdfPKCS7 pkcs7 = fields.verifySignature(sigName);
      if (pkcs7.isTsp()) {
          v.addVerification(sigName, ocsp, crl,
              LtvVerification.CertificateOption.SIGNING_CERTIFICATE,
              LtvVerification.Level.OCSP_CRL,
              LtvVerification.CertificateInclusion.NO);
      }
      else {
          for (String name : names) {
              v.addVerification(name, ocsp, crl,
                  LtvVerification.CertificateOption.WHOLE_CHAIN,
                  LtvVerification.Level.OCSP_CRL,
                  LtvVerification.CertificateInclusion.NO);
          }
      }
      PdfSignatureAppearance sap = stp.getSignatureAppearance();
      LtvTimestamp.timestamp(sap, tsa, null);
  }
  </code></pre>
  
  <p>versions that I am working with:</p>
  
  <ul>
  <li>itext: 5.5.11</li>
  <li>java: 8</li>
  </ul>