title: Pades Signature using PDFBox ETSI validation
body: <p>I created a PDF PAdES signature using PDFBOX and I am using the ETSI online validator <a href="https://signatures-conformance-checker.etsi.org/protected/upload.php?sigtype=padesconf" rel="nofollow noreferrer">1</a> (it requires registration) and right now I am getting only two errors on the report but im kind of lost about what they are or how can I fix them.</p>
  <p>This is the etsi online validator report:</p>
  <p><a href="https://i.stack.imgur.com/yzKkd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yzKkd.png" alt="" /></a></p>
  <p>And this is the code I am using to sign:</p>
  <pre><code>@Override
      public byte[] sign(InputStream content) throws IOException {
          try {
              CMSSignedDataGenerator signGenerator = new CMSSignedDataGenerator();
              X509Certificate userCert = (X509Certificate) this.certificateChain[0];
              ContentSigner mySigner = new CustomSigner(this.signerKeyHandle);
              // TODO check to use cavium as digest provider
              MessageDigest md = MessageDigest.getInstance(&quot;SHA-256&quot;, &quot;Cavium&quot;);
              md.update(userCert.getEncoded());
              byte[] userCertHash = md.digest();
              X509CertificateHolder issuerCert = new X509CertificateHolder(this.certificateChain[1].getEncoded());
              // IssuerSerial is = new IssuerSerial(issuerCert.get,
              // issuerCert.getSerialNumber());
              ESSCertIDv2 certid = new ESSCertIDv2(new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256),
                      userCertHash);
              ESSCertIDv2[] essCert1Arr = { certid };
              SigningCertificateV2 sigcert = new SigningCertificateV2(certid);
              final DERSet attrValues = new DERSet(sigcert);
              Attribute attr = new Attribute(PKCSObjectIdentifiers.id_aa_signingCertificateV2, attrValues);
              ASN1EncodableVector v = new ASN1EncodableVector();
              v.add(attr);
              AttributeTable atttributeTable = new AttributeTable(v);
               //Create a standard attribute table from the passed in parameters - certhash
               CMSAttributeTableGenerator attrGen = new DefaultSignedAttributeTableGenerator(atttributeTable){
                  protected Hashtable createStandardAttributeTable(Map parameters)
                  {
                      Hashtable result = super.createStandardAttributeTable(parameters);
                      result.remove(CMSAttributes.signingTime);
                      return result;
                  }
              };
              JcaSignerInfoGeneratorBuilder signerBuilder = new JcaSignerInfoGeneratorBuilder( new JcaDigestCalculatorProviderBuilder().build());
              signerBuilder.setSignedAttributeGenerator(attrGen);
              SignerInfoGenerator signerInfoGenerator = signerBuilder.build(mySigner, userCert);
              signGenerator.addSignerInfoGenerator(signerInfoGenerator);
              signGenerator.addCertificates(new JcaCertStore(Arrays.asList(certificateChain)));
              CMSProcessableInputStream msg = new CMSProcessableInputStream(content);
              CMSSignedData signedData = signGenerator.generate(msg, false);
              return signedData.getEncoded();
          } catch (GeneralSecurityException | CMSException | OperatorCreationException e) {
              System.err.println(e.getMessage());
              throw new RuntimeException(&quot;unable to sign pdf!&quot;);
          }
      }
  </code></pre>
  <p>Im not quite sure where those problems could be or why are they generated, at the beginning I had 5 and right now im only down to these two, so any input will be greatly appreciated</p>