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- See Also:
- RFC4253 section 6.6
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_ALGORITHMstatic intDSA_SIGNATURE_LENGTHstatic intMAX_SIGNATURE_VALUE_LENGTH
-
Constructor Summary
Constructors Modifier Constructor Description SignatureDSA()protectedSignatureDSA(java.lang.String algorithm)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidputBigInteger(java.math.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, getSshAlgorithmName, initSigner, initVerifier, toString, update
-
-
-
-
Field Detail
-
DEFAULT_ALGORITHM
public static final java.lang.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
-
-
Method Detail
-
sign
public byte[] sign(SessionContext session) throws java.lang.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:
java.lang.Exception- If failed to calculate the signature
-
putBigInteger
public static void putBigInteger(java.math.BigInteger value, byte[] result, int offset)
-
verify
public boolean verify(SessionContext session, byte[] sig) throws java.lang.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:
java.lang.Exception- If failed to extract signed data for validation
-
-