KeyPairGenerator: generateKeyPair()
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.SecureRandom;
public class Main {
public static void main(String[] args) throws Exception {
KeyPairGenerator kpg = KeyPairGenerator.getInstance("DSA");
kpg.initialize(1024, new SecureRandom());
KeyPair dsaKeyPair = kpg.generateKeyPair();
}
}
Related examples in the same category