Class SSHPublicKeyDecoder

java.lang.Object
org.cryptacular.ssh.SSHPublicKeyDecoder

public class SSHPublicKeyDecoder extends Object
Decodes public keys formatted as described in RFC 4253, Section 6.6, Public Key Algorithms. RSA and DSS key formats are supported.
Author:
Middleware Services
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bouncycastle.crypto.params.AsymmetricKeyParameter
    decode(byte[] encoded)
    Produces an asymmetric key parameter from an encoded representation.
    org.bouncycastle.crypto.params.AsymmetricKeyParameter
    decode(String pubData)
    Produces an asymmetric key parameter from an encoded representation.
    static boolean
    Attempts to infer whether the encoded bytes contain an SSH public key.
    static boolean
    Attempts to infer whether the encoded bytes contain an SSH public key.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SSHPublicKeyDecoder

      public SSHPublicKeyDecoder()
  • Method Details

    • isRFC4253EncodedPublicKey

      public static boolean isRFC4253EncodedPublicKey(String key)
      Attempts to infer whether the encoded bytes contain an SSH public key.
      Parameters:
      key - encoded key as a string
      Returns:
      true if encoding format is probable, false otherwise
    • isRFC4253EncodedPublicKey

      public static boolean isRFC4253EncodedPublicKey(byte[] key)
      Attempts to infer whether the encoded bytes contain an SSH public key.
      Parameters:
      key - encoded key as a byte array
      Returns:
      true if encoding format is probable, false otherwise
    • decode

      public org.bouncycastle.crypto.params.AsymmetricKeyParameter decode(byte[] encoded)
      Produces an asymmetric key parameter from an encoded representation.
      Parameters:
      encoded - encoded data
      Returns:
      Decoded object.
    • decode

      public org.bouncycastle.crypto.params.AsymmetricKeyParameter decode(String pubData)
      Produces an asymmetric key parameter from an encoded representation.
      Parameters:
      pubData - encoded data
      Returns:
      Decoded object.
      Throws:
      EncodingException - on encoding errors.