Class KeyPairIdentity
java.lang.Object
org.apache.sshd.client.auth.pubkey.KeyPairIdentity
- All Implemented Interfaces:
PublicKeyIdentity
,SignatureFactoriesHolder
Uses a
KeyPair
to generate the identity signature-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final KeyPair
private final List
<NamedFactory<Signature>> -
Constructor Summary
ConstructorsConstructorDescriptionKeyPairIdentity
(SignatureFactoriesManager primary, SignatureFactoriesManager secondary, KeyPair pair) -
Method Summary
Modifier and TypeMethodDescriptionsign
(SessionContext session, String algo, byte[] data) Proves the public key identity by signing the given datatoString()
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.SignatureFactoriesHolder
getSignatureFactoriesNameList, getSignatureFactoriesNames
-
Field Details
-
pair
-
signatureFactories
-
-
Constructor Details
-
KeyPairIdentity
public KeyPairIdentity(SignatureFactoriesManager primary, SignatureFactoriesManager secondary, KeyPair pair)
-
-
Method Details
-
getKeyIdentity
- Specified by:
getKeyIdentity
in interfacePublicKeyIdentity
- Returns:
- The
KeyPair
identity value
-
getSignatureFactories
- Specified by:
getSignatureFactories
in interfaceSignatureFactoriesHolder
- Returns:
- The list of named
Signature
factories
-
sign
public Map.Entry<String,byte[]> sign(SessionContext session, String algo, byte[] data) throws Exception Description copied from interface:PublicKeyIdentity
Proves the public key identity by signing the given data- Specified by:
sign
in interfacePublicKeyIdentity
- Parameters:
session
- TheSessionContext
for calling this method - may benull
if not called within a session contextalgo
- Recommended signature algorithm - ifnull
/empty then one will be selected based on the key type and/or signature factories. Note: even if specific algorithm specified, the implementation may disregard and choose anotherdata
- Data to sign- Returns:
- used algorithm + signed data - using the identity
- Throws:
Exception
- If failed to sign the data
-
toString
-