code: private byte[] encodePKCS7() throws CertificateEncodingException {
          PKCS7 p7 = new PKCS7(new AlgorithmId[0],
                               new ContentInfo(ContentInfo.DATA_OID, null),
                               certs.toArray(new X509Certificate[certs.size()]),
                               new SignerInfo[0]);
          DerOutputStream derout = new DerOutputStream();
          try {
              p7.encodeSignedData(derout);
          } catch (IOException ioe) {
              throw new CertificateEncodingException(ioe.getMessage());
          }
          return derout.toByteArray();
      }
docs: Encode the CertPath using PKCS#7 format.
  
  @return a byte array containing the binary encoding of the PKCS#7 object
  @exception CertificateEncodingException if an exception occurs