Code example for PKIXParameters

Methods: getTargetCertConstraints, setTargetCertConstraints

0
        if (taSet == null) {
            fail(getName() + ": not performed (could not create test TrustAnchor set)");
        } 
 
        X509CertSelector x509cs = new X509CertSelector();
        PKIXParameters p = new PKIXParameters(taSet);
        p.setTargetCertConstraints(x509cs);
        // get cert selector 
        X509CertSelector cs1 = (X509CertSelector)p.getTargetCertConstraints();
        // modify returned selector 
        cs1.setIssuer(testIssuer);
        // get cert selector again 
        X509CertSelector cs2 = (X509CertSelector)p.getTargetCertConstraints();
        // check that selector is not the same 
        assertNotSame("notTheSame", cs1, cs2);
        // check that selector's internal state has 
        // not been changed by above modification 
        assertFalse("stateNotChanged", testIssuer.equals(cs2.getIssuerAsString()));
    } 
 
    /**