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();
}

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 ( ) ; }
encode the certpath using pkcs # 7 format .
