private static List<X509Certificate> parsePKCS7(InputStream is) throws CertificateException {
  List<X509Certificate> certList;
  if (is == null) {
    throw new CertificateException("input stream is null");
  }
  try {
    if (is.markSupported() == false) {
      is=new ByteArrayInputStream(readAllBytes(is));
    }
    PKCS7 pkcs7=new PKCS7(is);
    X509Certificate[] certArray=pkcs7.getCertificates();
    if (certArray != null) {
      certList=Arrays.asList(certArray);
    }
 else {
      certList=new ArrayList<X509Certificate>(0);
    }
  }
 catch (  IOException ioe) {
    throw new CertificateException("IOException parsing PKCS7 data: " + ioe);
  }
  return Collections.unmodifiableList(certList);
}

private static List < X509Certificate > parsePKCS7 ( InputStream is ) throws CertificateException { List < X509Certificate > certList ; if ( is == null ) { throw new CertificateException ( "input stream is null" ) ; } try { if ( is . markSupported ( ) == false ) { is = new ByteArrayInputStream ( readAllBytes ( is ) ) ; } PKCS7 pkcs7 = new PKCS7 ( is ) ; X509Certificate [ ] certArray = pkcs7 . getCertificates ( ) ; if ( certArray != null ) { certList = Arrays . asList ( certArray ) ; } else { certList = new ArrayList < X509Certificate > ( 0 ) ; } } catch ( IOException ioe ) { throw new CertificateException ( "IOException parsing PKCS7 data: " + ioe ) ; } return Collections . unmodifiableList ( certList ) ; }
parse a pkcs # 7 format certpath from an inputstream . return an unmodifiable list of the certificates .
