code: private static boolean verifyCertificateChain(X509Certificate cert){
  		
  		if ( null == cert) {
  			LogUtil.writeErrorLog("cert must Not null");
  			return false;
  		}
  		
  		X509Certificate middleCert = CertUtil.getMiddleCert();
  		if (null == middleCert) {
  			LogUtil.writeErrorLog("middleCert must Not null");
  			return false;
  		}
  		
  		X509Certificate rootCert = CertUtil.getRootCert();
  		if (null == rootCert) {
  			LogUtil.writeErrorLog("rootCert or cert must Not null");
  			return false;
  		}
  		
  		try {
  		
  	        X509CertSelector selector = new X509CertSelector();
  	        selector.setCertificate(cert);
  	        
  	        Set<TrustAnchor> trustAnchors = new HashSet<TrustAnchor>();
  	        trustAnchors.add(new TrustAnchor(rootCert, null));
  	        PKIXBuilderParameters pkixParams = new PKIXBuilderParameters(
  			        trustAnchors, selector);
  	
  	        Set<X509Certificate> intermediateCerts = new HashSet<X509Certificate>();
  	        intermediateCerts.add(rootCert);
  	        intermediateCerts.add(middleCert);
  	        intermediateCerts.add(cert);
  	        
  	        pkixParams.setRevocationEnabled(false);
  	
  	        CertStore intermediateCertStore = CertStore.getInstance("Collection",
  	                new CollectionCertStoreParameters(intermediateCerts), "BC");
  	        pkixParams.addCertStore(intermediateCertStore);
  	
  	        CertPathBuilder builder = CertPathBuilder.getInstance("PKIX", "BC");
  	        
          	@SuppressWarnings("unused")
  			PKIXCertPathBuilderResult result = (PKIXCertPathBuilderResult) builder
                  .build(pkixParams);
  			LogUtil.writeLog("verify certificate chain succeed.");
  			return true;
          } catch (java.security.cert.CertPathBuilderException e){
  			LogUtil.writeErrorLog("verify certificate chain fail.", e);
  		} catch (Exception e) {
  			LogUtil.writeErrorLog("verify certificate chain exception: ", e);
  		}
  		return false;
  	}
docs: 验证书链。
  @param cert
  @return