Class OpenSSHPublicKeyUtil

java.lang.Object
org.bouncycastle.crypto.util.OpenSSHPublicKeyUtil

public class OpenSSHPublicKeyUtil extends Object
OpenSSHPublicKeyUtil utility classes for parsing OpenSSH public keys.
  • Method Details

    • 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 IOException
      Encode a public key from an AsymmetricKeyParameter instance.
      Parameters:
      cipherParameters - The key to encode.
      Returns:
      the key OpenSSH encoded.
      Throws:
      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.