Package org.apache.sshd.common.signature
Interface Signature
-
- All Superinterfaces:
AlgorithmNameProvider
- All Known Implementing Classes:
AbstractSecurityKeySignature,AbstractSignature,SignatureDSA,SignatureECDSA,SignatureECDSA.SignatureECDSA256,SignatureECDSA.SignatureECDSA384,SignatureECDSA.SignatureECDSA521,SignatureEd25519,SignatureRSA,SignatureRSASHA1,SignatureRSASHA256,SignatureRSASHA512,SignatureSkECDSA,SignatureSkED25519
public interface Signature extends AlgorithmNameProvider
Signature interface for SSH used to sign or verify packets. Usually wraps ajavax.crypto.Signatureobject. The reported algorithm name refers to the signature type being applied.- Author:
- Apache MINA SSHD Project
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default StringgetSshAlgorithmName(String algo)voidinitSigner(SessionContext session, PrivateKey key)voidinitVerifier(SessionContext session, PublicKey key)byte[]sign(SessionContext session)Compute the signaturedefault voidupdate(SessionContext session, byte[] hash)Update the computed signature with the given datavoidupdate(SessionContext session, byte[] hash, int off, int len)Update the computed signature with the given databooleanverify(SessionContext session, byte[] sig)Verify against the given signature-
Methods inherited from interface org.apache.sshd.common.AlgorithmNameProvider
getAlgorithm
-
-
-
-
Method Detail
-
initVerifier
void initVerifier(SessionContext session, PublicKey key) throws Exception
- Parameters:
session- TheSessionContextfor calling this method - may benullif not called within a session contextkey- ThePublicKeyto be used for verifying signatures- Throws:
Exception- If failed to initialize
-
initSigner
void initSigner(SessionContext session, PrivateKey key) throws Exception
- Parameters:
session- TheSessionContextfor calling this method - may benullif not called within a session contextkey- ThePrivateKeyto be used for signing- Throws:
Exception- If failed to initialize
-
update
default void update(SessionContext session, byte[] hash) throws Exception
Update the computed signature with the given data- Parameters:
session- TheSessionContextfor calling this method - may benullif not called within a session contexthash- The hash data buffer- Throws:
Exception- If failed to update- See Also:
update(SessionContext, byte[], int, int)
-
update
void update(SessionContext session, byte[] hash, int off, int len) throws Exception
Update the computed signature with the given data- Parameters:
session- TheSessionContextfor calling this method - may benullif not called within a session contexthash- The hash data bufferoff- Offset of hash data in bufferlen- Length of hash data- Throws:
Exception- If failed to update
-
verify
boolean verify(SessionContext session, byte[] sig) throws Exception
Verify against the given signature- Parameters:
session- TheSessionContextfor calling this method - may benullif not called within a session contextsig- The signed data- Returns:
trueif signature is valid- Throws:
Exception- If failed to extract signed data for validation
-
sign
byte[] sign(SessionContext session) throws Exception
Compute the signature- Parameters:
session- TheSessionContextfor calling this method - may benullif not called within a session context- Returns:
- The signature value
- Throws:
Exception- If failed to calculate the signature
-
-