Package org.bouncycastle.crypto.util
Class OpenSSHPublicKeyUtil
- java.lang.Object
-
- org.bouncycastle.crypto.util.OpenSSHPublicKeyUtil
-
public class OpenSSHPublicKeyUtil extends java.lang.Object
OpenSSHPublicKeyUtil utility classes for parsing OpenSSH public keys.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
parsePublicKey
public static AsymmetricKeyParameter parsePublicKey(byte[] encoded)
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
public static byte[] encodePublicKey(AsymmetricKeyParameter cipherParameters) throws java.io.IOException
Encode a public key from an AsymmetricKeyParameter instance.- Parameters:
cipherParameters
- The key to encode.- Returns:
- the key OpenSSH encoded.
- Throws:
java.io.IOException
-
parsePublicKey
public static AsymmetricKeyParameter parsePublicKey(org.bouncycastle.crypto.util.SSHBuffer buffer)
Parse a public key from an SSHBuffer instance.- Parameters:
buffer
- containing the SSH public key.- Returns:
- A CipherParameters instance.
-
-