Class SecurityKeyPublicKey

java.lang.Object
com.hierynomus.sshj.userauth.fido.SecurityKeyPublicKey
All Implemented Interfaces:
Serializable, Key, PublicKey

public class SecurityKeyPublicKey extends Object implements PublicKey
A public key for an OpenSSH FIDO/U2F security key, i.e. one of the sk-ecdsa-sha2-nistp256@openssh.com or sk-ssh-ed25519@openssh.com key types.

Such a key is a regular ECDSA (NIST P-256) or Ed25519 public key with an additional application string attached (typically "ssh:"). The application string is part of the SSH wire encoding of the key and is mixed into every signature the authenticator produces, so it has to travel with the key. This wrapper keeps the underlying PublicKey and the application together.

It deliberately does not implement ECKey or EdECKey so that KeyType.fromKey(java.security.Key) can tell a security-key public key apart from a plain ECDSA/Ed25519 public key.

See Also:
  • Constructor Details

    • SecurityKeyPublicKey

      public SecurityKeyPublicKey(PublicKey delegate, String application)
  • Method Details

    • getDelegate

      public PublicKey getDelegate()
      Returns:
      the underlying ECDSA (P-256) or Ed25519 public key.
    • getApplication

      public String getApplication()
      Returns:
      the application string, e.g. "ssh:".
    • getAlgorithm

      public String getAlgorithm()
      Specified by:
      getAlgorithm in interface Key
    • getFormat

      public String getFormat()
      Specified by:
      getFormat in interface Key
    • getEncoded

      public byte[] getEncoded()
      Specified by:
      getEncoded in interface Key
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object