Package org.apache.sshd.common.signature
Interface Signature
-
- All Superinterfaces:
AlgorithmNameProvider
- All Known Implementing Classes:
AbstractSignature
,SignatureDSA
,SignatureECDSA
,SignatureECDSA.SignatureECDSA256
,SignatureECDSA.SignatureECDSA384
,SignatureECDSA.SignatureECDSA521
,SignatureEd25519
,SignatureRSA
,SignatureRSASHA1
,SignatureRSASHA256
,SignatureRSASHA512
public interface Signature extends AlgorithmNameProvider
Signature interface for SSH used to sign or verify packets. Usually wraps ajavax.crypto.Signature
object. 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 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 signature-
Methods inherited from interface org.apache.sshd.common.AlgorithmNameProvider
getAlgorithm
-
-
-
-
Method Detail
-
initVerifier
void initVerifier(SessionContext session, PublicKey key) throws Exception
- 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
void initSigner(SessionContext session, PrivateKey key) throws Exception
- 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
default void update(SessionContext session, byte[] hash) throws Exception
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(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
- 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
boolean verify(SessionContext session, byte[] sig) throws Exception
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
byte[] sign(SessionContext session) throws Exception
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
-
-