Code example for TrustAnchor

Methods: getTrustedCert

0
 
        PublicKey pk = new TestKeyPair(keyAlg).getPublic();
 
        // sub testcase 1 
        TrustAnchor ta =
            new TrustAnchor(validCaNameRfc2253, pk, null);
        assertNull("null1", ta.getTrustedCert());
        // sub testcase 2 
        X500Principal x500p = new X500Principal(validCaNameRfc2253);
        ta = new TrustAnchor(x500p, pk, null);
        assertNull("null2", ta.getTrustedCert());
    } 
 
 
    /** 
     * Test #1 for <code>getCA()</code> method<br> 
     *   
     * Assertion: returns most trusted CA<br> 
     * Test preconditions: valid CA or CA name passed to the constructor<br> 
     * Expected: the same CA ot the CA with the same name must be returned 
     * by the method<br>