-
-
Save ryctabo/7eaf166d7c2b6266e9874d760b19fd15 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
// Read all bytes from the private key file | |
Path path = Paths.get(privateKeyFile); | |
byte[] bytes = Files.readAllBytes(path); | |
KeyFactory keyFactory = KeyFactory.getInstance("RSA"); | |
// Generate private key object from bytes | |
PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(bytes); | |
PrivateKey privateKey = keyFactory.generatePrivate(privateKeySpec); | |
// Print private key format | |
LOG.info(String.format("Private key format: %s", privateKey.getFormat())); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment