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 String
getSshAlgorithmName
(String algo) void
initSigner
(SessionContext session, PrivateKey key) void
initVerifier
(SessionContext session, PublicKey key) byte[]
sign
(SessionContext session) Compute the signaturedefault void
update
(SessionContext session, byte[] hash) Update the computed signature with the given datavoid
update
(SessionContext session, byte[] hash, int off, int len) Update the computed signature with the given databoolean
verify
(SessionContext session, byte[] sig) Verify against the given signatureMethods inherited from interface org.apache.sshd.common.AlgorithmNameProvider
getAlgorithm
-
Method Details
-
initVerifier
- Parameters:
session
- TheSessionContext
for calling this method - may benull
if not called within a session contextkey
- ThePublicKey
to be used for verifying signatures- Throws:
Exception
- If failed to initialize
-
initSigner
- Parameters:
session
- TheSessionContext
for calling this method - may benull
if not called within a session contextkey
- ThePrivateKey
to be used for signing- Throws:
Exception
- If failed to initialize
-
update
Update the computed signature with the given data- Parameters:
session
- TheSessionContext
for calling this method - may benull
if 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
- TheSessionContext
for calling this method - may benull
if 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
- TheSessionContext
for calling this method - may benull
if not called within a session contextsig
- The signed data- Returns:
true
if signature is valid- Throws:
Exception
- If failed to extract signed data for validation
-
sign
Compute the signature- Parameters:
session
- TheSessionContext
for calling this method - may benull
if 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
-