public interface

Signature

net.schmizz.sshj.signature.Signature
Known Indirect Subclasses

Class Overview

Signature interface for SSH used to sign or verify data. Usually wraps a javax.crypto.Signature object.

Summary

Public Methods
abstract void init(PublicKey pubkey, PrivateKey prvkey)
Initialize this signature with the given public key and private key.
abstract byte[] sign()
Compute the signature.
abstract void update(byte[] H, int off, int len)
Update the computed signature with the given data.
abstract void update(byte[] H)
Convenience method, same as calling update(byte[], int, int) with offset as 0 and H.length.
abstract boolean verify(byte[] sig)
Verify against the given signature.

Public Methods

public abstract void init (PublicKey pubkey, PrivateKey prvkey)

Initialize this signature with the given public key and private key. If the private key is null, only signature verification can be performed.

Parameters
pubkey (null-ok) specify in case verification is needed
prvkey (null-ok) specify in case signing is needed

public abstract byte[] sign ()

Compute the signature.

Returns
  • the computed signature

public abstract void update (byte[] H, int off, int len)

Update the computed signature with the given data.

Parameters
H Byte-array to update with
off Offset within the array
len Length until which to compute

public abstract void update (byte[] H)

Convenience method, same as calling update(byte[], int, int) with offset as 0 and H.length.

Parameters
H The byte-array to update with

public abstract boolean verify (byte[] sig)

Verify against the given signature.

Parameters
sig The signature to verify against
Returns
  • true on successful verification, false on failure