Top Description Methods
org.apache.sshd.common.signature

public Interface Signature

extends AlgorithmNameProvider
Known Direct Implementers
org.apache.sshd.common.signature.AbstractSecurityKeySignature, org.apache.sshd.common.signature.AbstractSignature
Imports
java.security.PrivateKey, .PublicKey, org.apache.sshd.common.AlgorithmNameProvider, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.NumberUtils

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.
Author
Apache MINA SSHD Project

Method Summary

Modifier and TypeMethod and Description
public default String

Returns:

The original ssh name of the signature algorithm
getSshAlgorithmName
(String
- the negotiated value
algo
)

public void
initSigner(SessionContext
The SessionContext for calling this method - may be null if not called within a session context
session
,
PrivateKey
The PrivateKey to be used for signing
key
)

public void
initVerifier(SessionContext
The SessionContext for calling this method - may be null if not called within a session context
session
,
PublicKey
The PublicKey to be used for verifying signatures
key
)

public byte[]

Returns:

The signature value
sign
(SessionContext
The SessionContext for calling this method - may be null if not called within a session context
session
)

Compute the signature

public default void
update(SessionContext
The SessionContext for calling this method - may be null if not called within a session context
session
,
byte[]
The hash data buffer
hash
)

Update the computed signature with the given data

public void
update(SessionContext
The SessionContext for calling this method - may be null if not called within a session context
session
,
byte[]
The hash data buffer
hash
,
int
Offset of hash data in buffer
off
,
int
Length of hash data
len
)

Update the computed signature with the given data

public boolean

Returns:

true if signature is valid
verify
(SessionContext
The SessionContext for calling this method - may be null if not called within a session context
session
,
byte[]
The signed data
sig
)

Verify against the given signature

Inherited from org.apache.sshd.common.AlgorithmNameProvider:
getAlgorithm

Method Detail

getSshAlgorithmNameback to summary
public default String getSshAlgorithmName(String algo)
Parameters
algo:String

- the negotiated value

Returns:String

The original ssh name of the signature algorithm

initSignerback to summary
public void initSigner(SessionContext session, PrivateKey key) throws Exception
Parameters
session:SessionContext

The SessionContext for calling this method - may be null if not called within a session context

key:PrivateKey

The PrivateKey to be used for signing

Exceptions
Exception:
If failed to initialize
initVerifierback to summary
public void initVerifier(SessionContext session, PublicKey key) throws Exception
Parameters
session:SessionContext

The SessionContext for calling this method - may be null if not called within a session context

key:PublicKey

The PublicKey to be used for verifying signatures

Exceptions
Exception:
If failed to initialize
signback to summary
public byte[] sign(SessionContext session) throws Exception

Compute the signature

Parameters
session:SessionContext

The SessionContext for calling this method - may be null if not called within a session context

Returns:byte[]

The signature value

Exceptions
Exception:
If failed to calculate the signature
updateback to summary
public default void update(SessionContext session, byte[] hash) throws Exception

Update the computed signature with the given data

Parameters
session:SessionContext

The SessionContext for calling this method - may be null if not called within a session context

hash:byte[]

The hash data buffer

Exceptions
Exception:
If failed to update
See Also
update(SessionContext, byte[], int, int)
updateback to summary
public void update(SessionContext session, byte[] hash, int off, int len) throws Exception

Update the computed signature with the given data

Parameters
session:SessionContext

The SessionContext for calling this method - may be null if not called within a session context

hash:byte[]

The hash data buffer

off:int

Offset of hash data in buffer

len:int

Length of hash data

Exceptions
Exception:
If failed to update
verifyback to summary
public boolean verify(SessionContext session, byte[] sig) throws Exception

Verify against the given signature

Parameters
session:SessionContext

The SessionContext for calling this method - may be null if not called within a session context

sig:byte[]

The signed data

Returns:boolean

true if signature is valid

Exceptions
Exception:
If failed to extract signed data for validation