Package net.schmizz.sshj.signature
Interface Signature
-
- All Known Implementing Classes:
AbstractSignature,AbstractSignatureDSA,SignatureDSA,SignatureECDSA,SignatureEdDSA,SignatureRSA
public interface SignatureSignature interface for SSH used to sign or verify data. Usually wraps ajavax.crypto.Signatureobject.
-
-
Method Summary
Modifier and Type Method Description byte[]encode(byte[] signature)Encode the signature as blogjava.lang.StringgetSignatureName()voidinitSign(java.security.PrivateKey prvkey)Initialize this signature with the given private key for signing.voidinitVerify(java.security.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 Detail
-
getSignatureName
java.lang.String getSignatureName()
-
initVerify
void initVerify(java.security.PublicKey pubkey)
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
void initSign(java.security.PrivateKey prvkey)
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
-
-