KeyStoreGenerator { public static KeyPair createRSAKeyPair(int bits, BadRandom random) throws NoSuchAlgorithmException { KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); keyPairGenerator.initialize(bits, random); KeyPair keyPair = keyPairGenerator.generateKeyPair(); return keyPair; } private  KeyStoreGenerator(); static KeyPair createRSAKeyPair(int bits, BadRandom random); static KeyPair createECKeyPair(int bits, BadRandom random); static KeyPair createGost01KeyPair(String curve, BadRandom random); static KeyPair createGost12KeyPair(String curve, BadRandom random); static KeyStore createKeyStore(KeyPair keyPair, BadRandom random); static final String PASSWORD; static final String ALIAS; }
@Test public void testCreateRSAKeyPair() throws Exception { KeyPair k = KeyStoreGenerator.createRSAKeyPair(1024, random); assertNotNull(k); assertEquals("RSA", k.getPublic().getAlgorithm()); }