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 ajavax.crypto.Signature
object.
-
-
Method Summary
Modifier and Type Method Description byte[]
encode(byte[] signature)
Encode the signature as blogjava.lang.String
getSignatureName()
void
initSign(java.security.PrivateKey prvkey)
Initialize this signature with the given private key for signing.void
initVerify(java.security.PublicKey pubkey)
Initialize this signature with the given public key for signature verification.byte[]
sign()
Compute the signature.void
update(byte[] H)
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
-
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:
true
on successful verification,false
on failure
-
-