Package org.apache.sshd.common.signature
Class SignatureDSA
- java.lang.Object
-
- org.apache.sshd.common.signature.AbstractSignature
-
- org.apache.sshd.common.signature.SignatureDSA
-
- All Implemented Interfaces:
AlgorithmNameProvider,Signature
public class SignatureDSA extends AbstractSignature
DSASignature- Author:
- Apache MINA SSHD Project
- See Also:
- RFC4253 section 6.6
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_ALGORITHMstatic intDSA_SIGNATURE_LENGTHstatic intMAX_SIGNATURE_VALUE_LENGTH
-
Constructor Summary
Constructors Modifier Constructor Description SignatureDSA()protectedSignatureDSA(String algorithm)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidputBigInteger(BigInteger value, byte[] result, int offset)byte[]sign(SessionContext session)Compute the signaturebooleanverify(SessionContext session, byte[] sig)Verify against the given signature-
Methods inherited from class org.apache.sshd.common.signature.AbstractSignature
doInitSignature, doVerify, extractEncodedSignature, extractEncodedSignature, getAlgorithm, getSignature, initSigner, initVerifier, toString, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.signature.Signature
getSshAlgorithmName, update
-
-
-
-
Field Detail
-
DEFAULT_ALGORITHM
public static final String DEFAULT_ALGORITHM
- See Also:
- Constant Field Values
-
DSA_SIGNATURE_LENGTH
public static final int DSA_SIGNATURE_LENGTH
- See Also:
- Constant Field Values
-
MAX_SIGNATURE_VALUE_LENGTH
public static final int MAX_SIGNATURE_VALUE_LENGTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SignatureDSA
public SignatureDSA()
-
SignatureDSA
protected SignatureDSA(String algorithm)
-
-
Method Detail
-
sign
public byte[] sign(SessionContext session) throws Exception
Description copied from interface:SignatureCompute the signature- Specified by:
signin interfaceSignature- Overrides:
signin classAbstractSignature- Parameters:
session- TheSessionContextfor calling this method - may benullif not called within a session context- Returns:
- The signature value
- Throws:
Exception- If failed to calculate the signature
-
putBigInteger
public static void putBigInteger(BigInteger value, byte[] result, int offset)
-
verify
public boolean verify(SessionContext session, byte[] sig) throws Exception
Description copied from interface:SignatureVerify against the given signature- 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
-
-