Class OpenSSHPublicKeyUtil


  • public class OpenSSHPublicKeyUtil
    extends java.lang.Object
    OpenSSHPublicKeyUtil utility classes for parsing OpenSSH public keys.
    • 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.