public static X509Certificate[] establishTrust(X509Certificate cert,KeyStore keyStores[]) throws CryptoException {
  ArrayList<X509Certificate> ksCerts=new ArrayList<X509Certificate>();
  for (int i=0; i < keyStores.length; i++) {
    ksCerts.addAll(extractCertificates(keyStores[i]));
  }
  return establishTrust(cert,ksCerts);
}

public static X509Certificate [ ] establishTrust ( X509Certificate cert , KeyStore keyStores [ ] ) throws CryptoException { ArrayList < X509Certificate > ksCerts = new ArrayList < X509Certificate > ( ) ; for ( int i = 0 ; i < keyStores . length ; i ++ ) { ksCerts . addAll ( extractCertificates ( keyStores [ i ] ) ) ; } return establishTrust ( cert , ksCerts ) ; }
check whether or not a trust path exists between the supplied x . 509 certificate and and the supplied keystores based on the trusted certificates contained therein , ie that a chain of trust exists between the supplied certificate and a self - signed trusted certificate in the keystores .
