Class PrivateKeyUtils
java.lang.Object
se.swedenconnect.security.credential.utils.PrivateKeyUtils
Utility methods for handling private keys.
- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
Method Summary
Modifier and TypeMethodDescriptionstatic PrivateKey
decodePrivateKey
(byte[] bytes) Decodes a private key in DER, PEM, and unencrypted PKCS#8 formats.static PrivateKey
decodePrivateKey
(InputStream stream) Decodes a private key in DER, PEM, and unencrypted PKCS#8 formats.static PrivateKey
decodePrivateKey
(Resource resource) Decodes a private key in DER, PEM, and unencrypted PKCS#8 formats.
-
Method Details
-
decodePrivateKey
Decodes a private key in DER, PEM, and unencrypted PKCS#8 formats.- Parameters:
bytes
- the key bytes- Returns:
- the decoded private key
- Throws:
KeyException
- for decoding errors
-
decodePrivateKey
Decodes a private key in DER, PEM, and unencrypted PKCS#8 formats.The method does not close the input stream.
- Parameters:
stream
- the input stream- Returns:
- the decoded private key
- Throws:
KeyException
- for decoding errors
-
decodePrivateKey
Decodes a private key in DER, PEM, and unencrypted PKCS#8 formats.- Parameters:
resource
- the resource- Returns:
- the decoded private key
- Throws:
KeyException
- for decoding errors
-