public static KeyFactory getKeyFactory() throws NoSuchAlgorithmException { if (keyFactory == null) { keyFactory = KeyFactory.getInstance(getKeyAlgorithm()); } return keyFactory; }
public static KeyPairGenerator getKeyPairGenerator() throws NoSuchProviderException, NoSuchAlgorithmException { if (keyPairGenerator == null) { keyPairGenerator = KeyPairGenerator.getInstance(getKeyAlgorithm()); keyPairGenerator.initialize(getKeyLength()); } return keyPairGenerator; }