Code example for TrustAnchor

Methods: getCAName

0
 
        PublicKey pk = new TestKeyPair(keyAlg).getPublic();
 
        // sub testcase 1 
        TrustAnchor ta =
            new TrustAnchor(validCaNameRfc2253, pk, null);
        assertEquals("equals1", validCaNameRfc2253, ta.getCAName());
        // sub testcase 2 
        X500Principal x500p = new X500Principal(validCaNameRfc2253);
        ta = new TrustAnchor(x500p, pk, null);
        assertEquals("equals2", validCaNameRfc2253, ta.getCAName());
    } 
 
    /** 
     * Test #2 for <code>getCAName()</code> method<br> 
     *   
     * Assertion: returns ... <code>null</code> if <code>TrustAnchor</code> 
     * was not specified as trusted certificate<br> 
     * Test preconditions: test object is not specified as trusted certificate<br> 
     * Expected: <code>null</code> as return value<br> 
     * @throws InvalidKeySpecException