Package org.apache.sshd.common.signature
Class AbstractSecurityKeySignature
java.lang.Object
org.apache.sshd.common.signature.AbstractSecurityKeySignature
- All Implemented Interfaces:
AlgorithmNameProvider
,Signature
- Direct Known Subclasses:
SignatureSkECDSA
,SignatureSkED25519
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate MessageDigest
private static final int
private final String
private SecurityKeyPublicKey<?>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Signature
protected abstract String
void
initSigner
(SessionContext session, PrivateKey key) void
initVerifier
(SessionContext session, PublicKey key) byte[]
sign
(SessionContext session) Compute the signaturevoid
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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.sshd.common.AlgorithmNameProvider
getAlgorithm
Methods inherited from interface org.apache.sshd.common.signature.Signature
getSshAlgorithmName, update
-
Field Details
-
FLAG_USER_PRESENCE
private static final int FLAG_USER_PRESENCE- See Also:
-
keyType
-
publicKey
-
challengeDigest
-
-
Constructor Details
-
AbstractSecurityKeySignature
-
-
Method Details
-
initVerifier
- Specified by:
initVerifier
in interfaceSignature
- Parameters:
session
- TheSessionContext
for calling this method - may benull
if not called within a session contextkey
- ThePublicKey
to be used for verifying signatures- Throws:
GeneralSecurityException
-
update
Description copied from interface:Signature
Update the computed signature with the given data- Specified by:
update
in interfaceSignature
- 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
-
getSignatureKeyType
-
getDelegateSignature
-
verify
Description copied from interface:Signature
Verify against the given signature- Specified by:
verify
in interfaceSignature
- 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
-
initSigner
- Specified by:
initSigner
in interfaceSignature
- Parameters:
session
- TheSessionContext
for calling this method - may benull
if not called within a session contextkey
- ThePrivateKey
to be used for signing
-
sign
Description copied from interface:Signature
Compute the signature- Specified by:
sign
in interfaceSignature
- Parameters:
session
- TheSessionContext
for calling this method - may benull
if not called within a session context- Returns:
- The signature value
-