Package org.bouncycastle.crypto.util
Class OpenSSHPublicKeyUtil
java.lang.Object
org.bouncycastle.crypto.util.OpenSSHPublicKeyUtil
OpenSSHPublicKeyUtil utility classes for parsing OpenSSH public keys.
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
encodePublicKey
(AsymmetricKeyParameter cipherParameters) Encode a public key from an AsymmetricKeyParameter instance.static AsymmetricKeyParameter
parsePublicKey
(byte[] encoded) Parse a public key.static AsymmetricKeyParameter
parsePublicKey
(org.bouncycastle.crypto.util.SSHBuffer buffer) Parse a public key from an SSHBuffer instance.
-
Method Details
-
parsePublicKey
Parse a public key.This method accepts the bytes that are Base64 encoded in an OpenSSH public key file.
- Parameters:
encoded
- The key.- Returns:
- An AsymmetricKeyParameter instance.
-
encodePublicKey
Encode a public key from an AsymmetricKeyParameter instance.- Parameters:
cipherParameters
- The key to encode.- Returns:
- the key OpenSSH encoded.
- Throws:
IOException
-
parsePublicKey
Parse a public key from an SSHBuffer instance.- Parameters:
buffer
- containing the SSH public key.- Returns:
- A CipherParameters instance.
-