code: public static boolean verifyCertificate(X509Certificate cert) {
  		
  		if ( null == cert) {
  			LogUtil.writeErrorLog("cert must Not null");
  			return false;
  		}
  		try {
  			cert.checkValidity();//验证有效期
  //			cert.verify(middleCert.getPublicKey());
  			if(!verifyCertificateChain(cert)){
  				return false;
  			}
  		} catch (Exception e) {
  			LogUtil.writeErrorLog("verifyCertificate fail", e);
  			return false;
  		}
  		
  		if(SDKConfig.getConfig().isIfValidateCNName()){
  			// 验证公钥是否属于银联
  			if(!UNIONPAY_CNNAME.equals(CertUtil.getIdentitiesFromCertficate(cert))) {
  				LogUtil.writeErrorLog("cer owner is not CUP:" + CertUtil.getIdentitiesFromCertficate(cert));
  				return false;
  			}
  		} else {
  			// 验证公钥是否属于银联
  			if(!UNIONPAY_CNNAME.equals(CertUtil.getIdentitiesFromCertficate(cert)) 
  					&& !"00040000:SIGN".equals(CertUtil.getIdentitiesFromCertficate(cert))) {
  				LogUtil.writeErrorLog("cer owner is not CUP:" + CertUtil.getIdentitiesFromCertficate(cert));
  				return false;
  			}
  		}
  		return true;		
  	}
docs: 检查证书链
  
  @param rootCerts
  根证书
  @param cert
  待验证的证书
  @return