Code example for KeyFactory

Methods: generatePrivate, getKeySpec

0
     */ 
    public final void testGetKeySpec04() throws Exception { 
 
        KeySpec ks;
 
        ks = kf.getKeySpec( privateKey, DSAPrivateKeySpec.class);
        checkPrivateKeys( (DSAPrivateKey) kf.generatePrivate((DSAPrivateKeySpec) ks) );
 
        ks = kf.getKeySpec( privateKey, PKCS8EncodedKeySpec.class);
        checkPrivateKeys( (DSAPrivateKey) kf.generatePrivate((PKCS8EncodedKeySpec) ks) );
    } 
 
 
    /** 
     * Compatibility with RI test. 
     * A test against the "getKeySpec(Key, Class)" method. 
     * It checks out that if Key is DSAPrivateKey having incorrect encoding 
     * the method doesn't throw up InvalidKeySpecException. 
     */ 
    public final void testGetKeySpec05() throws Exception {