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.String
DEFAULT_ALGORITHM
static int
DSA_SIGNATURE_LENGTH
static int
MAX_SIGNATURE_VALUE_LENGTH
-
Constructor Summary
Constructors Modifier Constructor Description SignatureDSA()
protected
SignatureDSA(java.lang.String algorithm)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
putBigInteger(java.math.BigInteger value, byte[] result, int offset)
byte[]
sign(SessionContext session)
Compute the signatureboolean
verify(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 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:Signature
Compute the signature- Specified by:
sign
in interfaceSignature
- Overrides:
sign
in classAbstractSignature
- Parameters:
session
- TheSessionContext
for calling this method - may benull
if 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:Signature
Verify against the given signature- 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:
java.lang.Exception
- If failed to extract signed data for validation
-
-