Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lkdocs/6526803 to your computer and use it in GitHub Desktop.
Save lkdocs/6526803 to your computer and use it in GitHub Desktop.
public static KeyPair generateRSAKeyPair() throws Exception {
SecureRandom random = new SecureRandom();
RSAKeyGenParameterSpec spec = new RSAKeyGenParameterSpec(KEY_SIZE, RSAKeyGenParameterSpec.F4);
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "SC");
generator.initialize(spec, random);
return generator.generateKeyPair();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment