Package org.apache.sshd.common.signature
Class SignatureRSA
- java.lang.Object
-
- org.apache.sshd.common.signature.AbstractSignature
-
- org.apache.sshd.common.signature.SignatureRSA
-
- All Implemented Interfaces:
AlgorithmNameProvider,Signature
- Direct Known Subclasses:
SignatureRSASHA1,SignatureRSASHA256,SignatureRSASHA512
public abstract class SignatureRSA extends AbstractSignature
RSASignature- See Also:
- RFC4253 section 6.6
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringsshAlgorithmNamestatic java.util.NavigableSet<java.lang.String>SUPPORTED_KEY_TYPESprivate intverifierSignatureSize
-
Constructor Summary
Constructors Modifier Constructor Description protectedSignatureRSA(java.lang.String algorithm, java.lang.String sshAlgorithmName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetSshAlgorithmName(java.lang.String algo)protected intgetVerifierSignatureSize()static intgetVerifierSignatureSize(java.security.interfaces.RSAKey key)voidinitVerifier(SessionContext session, java.security.PublicKey key)booleanverify(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, sign, toString, update
-
-
-
-
Method Detail
-
getSshAlgorithmName
public java.lang.String getSshAlgorithmName(java.lang.String algo)
- Parameters:
algo- - the negotiated value- Returns:
- The original ssh name of the signature algorithm
-
getVerifierSignatureSize
protected int getVerifierSignatureSize()
- Returns:
- The expected number of bytes in the signature - non-positive if not initialized or not intended to be used for verification
-
initVerifier
public void initVerifier(SessionContext session, java.security.PublicKey key) throws java.lang.Exception
- Specified by:
initVerifierin interfaceSignature- Overrides:
initVerifierin classAbstractSignature- Parameters:
session- TheSessionContextfor calling this method - may benullif not called within a session contextkey- ThePublicKeyto be used for verifying signatures- Throws:
java.lang.Exception- If failed to initialize
-
getVerifierSignatureSize
public static int getVerifierSignatureSize(java.security.interfaces.RSAKey key)
-
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
-
-