private static void verifyCertificates(Certificate[] certificates) throws GeneralSecurityException {
  GeneralSecurityException lastException=null;
  boolean verified=false;
  for (  Certificate certificate : certificates) {
    try {
      certificate.verify(key);
      verified=true;
      break;
    }
 catch (    GeneralSecurityException e) {
      lastException=e;
    }
  }
  if (!verified) {
    throw lastException;
  }
}

private static void verifyCertificates ( Certificate [ ] certificates ) throws GeneralSecurityException { GeneralSecurityException lastException = null ; boolean verified = false ; for ( Certificate certificate : certificates ) { try { certificate . verify ( key ) ; verified = true ; break ; } catch ( GeneralSecurityException e ) { lastException = e ; } } if ( ! verified ) { throw lastException ; } }
verify the given certificates and see if at least one was signed by us .
