Created
June 2, 2015 14:24
-
-
Save luismoramedina/a3adec531e8028679377 to your computer and use it in GitHub Desktop.
Extracts the public key from a x509 certificate.
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
CertificateFactory x509 = CertificateFactory.getInstance("X509"); | |
FileInputStream inStream = new FileInputStream(CERTIFICATE_PATH); | |
Certificate certificate = x509.generateCertificate(inStream); | |
byte[] encoded = certificate.getPublicKey().getEncoded(); | |
FileOutputStream fileOutputStream = new FileOutputStream("c:/data/temp/phoenix-public-key.bin"); | |
fileOutputStream.write(encoded); | |
fileOutputStream.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment