Created
November 14, 2016 12:29
-
-
Save tassioauad/8d144abbeb9931093878cb28f638710d to your computer and use it in GitHub Desktop.
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
// Convertendo os bytes salvos em instâncias | |
byte[] privateKeyBytes = privateKey.getEncoded(); | |
byte[] publicKeyBytes = publicKey.getEncoded(); | |
KeyFactory keyFactory = KeyFactory.getInstance("RSA"); | |
EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(privateKeyBytes); | |
PrivateKey privateKey = keyFactory.generatePrivate(privateKeySpec); | |
EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(publicKeyBytes); | |
PublicKey publicKey = keyFactory.generatePublic(publicKeySpec); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment