Code example for TrustAnchor

Methods: getNameConstraints

        PublicKey pk = new TestKeyPair(keyAlg).getPublic();
        byte[] nc = getEncodingPSOnly();
        byte[] ncCopy = nc.clone();
        // sub testcase 5 - nameConstraints can be null 
        TrustAnchor ta = new TrustAnchor(new X500Principal(validCaNameRfc2253),
                pk, ncCopy);
        // modify 
        // check that above modification did not change 
        // object internal state 
        assertTrue(Arrays.equals(nc, ta.getNameConstraints()));
     * Test #4 for <code>TrustAnchor(X500Principal, PublicKey, byte[])</code> constructor<br>  
     * Assertion: <code>NullPointerException</code> if <code>caPrincipal</code> 
     * or <code>caPublicKey</code> parameter is <code>null</code><br> 
     * Test preconditions: pass <code>null</code> as mentioned parameter<br> 
     * Expected: NullPointerException 
Experience pair programming with AI  Get Codota for Java