Java examples for Security:Key
create Key Factory by algorithm
//package com.java2s; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; public class Main { public static void main(String[] argv) throws Exception { String algorithm = "java2s.com"; System.out.println(createKeyFactory(algorithm)); }/*from www . j a va 2 s. c o m*/ public static KeyFactory createKeyFactory(String algorithm) { try { return KeyFactory.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("required " + algorithm + " key factory not supported", e); } } }