-
-
Save ryctabo/5b158c3266b7243f2d736c19967b1c06 to your computer and use it in GitHub Desktop.
Get instance of KeyPairGenerator class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); | |
keyPairGenerator.initialize(1024); | |
KeyPair keyPair = keyPairGenerator.generateKeyPair(); | |
PublicKey publicKey = keyPair.getPublic(); | |
PrivateKey privateKey = keyPair.getPrivate(); | |
} catch (NoSuchAlgorithmException e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment