Interface SshPublicKey

All Superinterfaces:
Component, SecureComponent
All Known Subinterfaces:
SshDsaPublicKey, SshEd25519PublicKey, SshEd448PublicKey, SshRsaPublicKey
All Known Implementing Classes:
OpenSshCertificate, OpenSshEcdsaCertificate, OpenSshEcdsaSha2Nist256Certificate, OpenSshEcdsaSha2Nist384Certificate, OpenSshEcdsaSha2Nist521Certificate, OpenSshEd25519Certificate, OpenSshRsaCertificate, OpenSshRsaSha256Certificate, OpenSshRsaSha512Certificate, Ssh2DsaPublicKey, Ssh2EcdsaSha2Nist256PublicKey, Ssh2EcdsaSha2Nist384PublicKey, Ssh2EcdsaSha2Nist521PublicKey, Ssh2EcdsaSha2NistPublicKey, Ssh2RsaPublicKey, Ssh2RsaPublicKeySHA256, Ssh2RsaPublicKeySHA512, SshEd25519PublicKeyJCE, SshEd448PublicKeyJCE

public interface SshPublicKey extends SecureComponent

Interface for SSH supported public keys.

Author:
Lee David Painter
  • Method Details

    • init

      SshPublicKey init(byte[] blob, int start, int len) throws SshException
      Initialize the public key from a blob of binary data.
      Parameters:
      blob -
      start -
      len -
      Throws:
      SshException
    • init

      default SshPublicKey init(byte[] blob) throws SshException
      Throws:
      SshException
    • getAlgorithm

      String getAlgorithm()
      Get the algorithm name for the public key.
      Specified by:
      getAlgorithm in interface SecureComponent
      Returns:
      the algorithm name, for example "ssh-dss"
    • getSigningAlgorithm

      String getSigningAlgorithm()
      The algorithm name expected to be encoded in SSH signatures
    • getEncodingAlgorithm

      String getEncodingAlgorithm()
      The algorithm name used in the encoding of the public key
    • getBitLength

      int getBitLength()
      Get the bit length of the public key
      Returns:
      the bit length of the public key
    • getEncoded

      byte[] getEncoded() throws SshException
      Encode the public key into a blob of binary data, the encoded result will be passed into init to recreate the key.
      Returns:
      an encoded byte array
      Throws:
      SshException
    • getFingerprint

      String getFingerprint() throws SshException
      Return an SSH fingerprint of the public key
      Returns:
      String
      Throws:
      SshException
    • verifySignature

      boolean verifySignature(byte[] signature, byte[] data) throws SshException
      Verify the signature.
      Parameters:
      signature -
      data -
      Returns:
      true if the signature was produced by the corresponding private key that owns this public key, otherwise false.
      Throws:
      SshException
    • test

      String test()
      Test the JCE for algorithm availability.
      Returns:
    • getJCEPublicKey

      PublicKey getJCEPublicKey()
      Return the JCE component for this key.
      Returns:
    • isCertificate

      default boolean isCertificate()
      Indicates if this key is part of a certificate.
      Returns: