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
public abstract class AbstractSecurityKeySignature extends Object implements Signature
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSecurityKeySignature(String keyType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract SignaturegetDelegateSignature()protected abstract StringgetSignatureKeyType()voidinitSigner(SessionContext session, PrivateKey key)voidinitVerifier(SessionContext session, PublicKey key)byte[]sign(SessionContext session)Compute the signaturevoidupdate(SessionContext session, byte[] hash, int off, int len)Update the computed signature with the given databooleanverify(SessionContext session, byte[] sig)Verify against the given signature-
Methods 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
-
-
-
-
Constructor Detail
-
AbstractSecurityKeySignature
protected AbstractSecurityKeySignature(String keyType)
-
-
Method Detail
-
initVerifier
public void initVerifier(SessionContext session, PublicKey key) throws GeneralSecurityException
- Specified by:
initVerifierin interfaceSignature- Parameters:
session- TheSessionContextfor calling this method - may benullif not called within a session contextkey- ThePublicKeyto be used for verifying signatures- Throws:
GeneralSecurityException
-
update
public void update(SessionContext session, byte[] hash, int off, int len)
Description copied from interface:SignatureUpdate the computed signature with the given data- Specified by:
updatein interfaceSignature- 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
-
getSignatureKeyType
protected abstract String getSignatureKeyType()
-
getDelegateSignature
protected abstract Signature getDelegateSignature()
-
verify
public boolean verify(SessionContext session, byte[] sig) throws Exception
Description copied from interface:SignatureVerify against the given signature- Specified by:
verifyin interfaceSignature- 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
-
initSigner
public void initSigner(SessionContext session, PrivateKey key)
- Specified by:
initSignerin interfaceSignature- Parameters:
session- TheSessionContextfor calling this method - may benullif not called within a session contextkey- ThePrivateKeyto be used for signing
-
sign
public byte[] sign(SessionContext session)
Description copied from interface:SignatureCompute the signature- Specified by:
signin interfaceSignature- Parameters:
session- TheSessionContextfor calling this method - may benullif not called within a session context- Returns:
- The signature value
-
-