Code example for KeyFactory

Methods: getKeySpec

0
     * The test checks out that the method throws up NullPointerException 
     * if null is passed to a "Class" argument. 
     */ 
    public final void testGetKeySpec02() throws Exception { 
        try { 
            kf.getKeySpec(privateKey, null);
            fail("testcase1: No NullPointerException");
        } catch (NullPointerException e) {
        } 
        try { 
            kf.getKeySpec(publicKey, null);
            fail("testcase2: No NullPointerException");
        } catch (NullPointerException e) {
        } 
    } 
 
 
    /** 
     * A test against the "getKeySpec(Key, Class)" method. 
     * The test checks out that  
     * 1) a KeySpec returned by the method is being casted to