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
Signature interface for SSH used to sign or verify packets. Usually wraps a
javax.crypto.Signature object.
The reported algorithm name refers to the signature type being applied.-
Method Summary
Modifier and TypeMethodDescriptiondefault 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 signatureMethods inherited from interface org.apache.sshd.common.AlgorithmNameProvider
getAlgorithm
-
Method Details
-
initVerifier
- 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
- 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
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
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
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
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
-
getSshAlgorithmName
- Parameters:
algo- - the negotiated value- Returns:
- The original ssh name of the signature algorithm
-