Code example for KeyFactory

Methods: generatePublic

0
        kf = KeyFactory.getInstance(this.algorithmName);
    } 
 
    public PublicKey getPublic() throws
            InvalidKeySpecException { 
        return kf.generatePublic(
                new X509EncodedKeySpec(
                        (byte[])publicKeyEncoding.get(algorithmName)));
    } 
 
    public PrivateKey getPrivate() throws
            InvalidKeySpecException { 
        return kf.generatePrivate(
                new PKCS8EncodedKeySpec(
                        (byte[])privateKeyEncoding.get(algorithmName)));
    } 
 
}