Code example for TrustAnchor

0
            return(false); 
        } 
    } 
 
    public static void createParams() throws Exception { 
        TrustAnchor anchor = new TrustAnchor(getCertFromFile("sun.cer"), null);
        Set anchors = Collections.singleton(anchor);
        // Create odd CertSelector 
        sel = new OddSel();
        params = new PKIXBuilderParameters(anchors, sel);
        params.setRevocationEnabled(false);
    } 
 
    /** 
     * Get a DER-encoded X.509 certificate from a file. 
     * 
     * @param certFilePath path to file containing DER-encoded certificate 
     * @return X509Certificate 
     * @throws IOException on error 
     */ 
    public static X509Certificate getCertFromFile(String certFilePath)