Generating a Key Pair

KeyPairGenerator gen =
    KeyPairGenerator.getInstance("DSA");

SecureRandom random =
    new SecureRandom(rndBytes);
gen.initialize(1024, random);

KeyPair pair = gen.generateKeyPair();
PrivateKey priv = pair.getPrivate();
PublicKey pub = pair.getPublic();

Return to Tracks