# Signature (sshj 0.4.1 API)
Date: 2011-06-19

## net.schmizz.sshj.signature
Interface Signature

All Known Implementing Classes:
  AbstractSignature, SignatureDSA, SignatureRSA

    public interface Signature

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

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

Method Detail

### init

    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

### update

    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

### update

    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

### sign

    byte[] sign()

  Compute the signature.

  Returns:
    the computed signature

### verify

    boolean verify(byte[] sig)

  Verify against the given signature.

  Parameters:
    `sig` - the signature to verify against
  Returns:
    `true` on successful verification, `false` on failure

Copyright © 2009-2011. All Rights Reserved.