Code example for PKIXParameters

Methods: getTargetCertConstraintssetTargetCertConstraints

        if (taSet == null) {
            fail(getName() + ": not performed (could not create test TrustAnchor set)");
        X509CertSelector x509cs = new X509CertSelector();
        PKIXParameters p = new PKIXParameters(taSet);
        // get cert selector 
        X509CertSelector cs1 = (X509CertSelector)p.getTargetCertConstraints();
        // modify returned selector 
        // 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()));