Here you can find the source of getKeyFactory()
public static KeyFactory getKeyFactory()
//package com.java2s; import java.security.*; public class Main { private static final String KEY_ALGORITHM = "RSA"; public static KeyFactory getKeyFactory() { KeyFactory keyFactory = null; try {/*from w w w . jav a 2 s. co m*/ keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); } catch (NoSuchAlgorithmException nsae) { // Leave keyFactory as null } return keyFactory; } }