Package net.schmizz.sshj.signature
Interface Signature
- All Known Implementing Classes:
AbstractSignature,AbstractSignatureDSA,SignatureDSA,SignatureECDSA,SignatureEdDSA,SignatureRSA
public interface Signature
Signature interface for SSH used to sign or verify data. Usually wraps a
javax.crypto.Signature object.-
Method Summary
Modifier and TypeMethodDescriptionbyte[]encode(byte[] signature) Encode the signature as blogvoidinitSign(PrivateKey prvkey) Initialize this signature with the given private key for signing.voidinitVerify(PublicKey pubkey) Initialize this signature with the given public key for signature verification.byte[]sign()Compute the signature.voidupdate(byte[] H) voidupdate(byte[] H, int off, int len) Update the computed signature with the given data.booleanverify(byte[] sig) Verify against the given signature.
-
Method Details
-
getSignatureName
String getSignatureName() -
initVerify
Initialize this signature with the given public key for signature verification. Note that subsequent calls to eitherinitVerify(PublicKey)orinitSign(PrivateKey)will overwrite prior initialization.- Parameters:
pubkey- the public key to use for signature verification
-
initSign
Initialize this signature with the given private key for signing. Note that subsequent calls to eitherinitVerify(PublicKey)orinitSign(PrivateKey)will overwrite prior initialization.- Parameters:
prvkey- the private key to use for signing
-
update
void update(byte[] H) - 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 withoff- offset within the arraylen- length until which to compute
-
sign
byte[] sign()Compute the signature.- Returns:
- the computed signature
-
encode
byte[] encode(byte[] signature) Encode the signature as blog- Parameters:
signature- the signature to encode- Returns:
- Encoded signature
-
verify
boolean verify(byte[] sig) Verify against the given signature.- Parameters:
sig- the signature to verify against- Returns:
trueon successful verification,falseon failure
-