Class KeyAgentIdentity
- java.lang.Object
-
- org.apache.sshd.client.auth.pubkey.KeyAgentIdentity
-
- All Implemented Interfaces:
PublicKeyIdentity
public class KeyAgentIdentity extends java.lang.Object implements PublicKeyIdentity
Uses anSshAgent
to generate the identity signature
-
-
Constructor Summary
Constructors Constructor Description KeyAgentIdentity(SshAgent agent, java.security.PublicKey key, java.lang.String comment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getComment()
java.security.PublicKey
getPublicKey()
java.util.Map.Entry<java.lang.String,byte[]>
sign(SessionContext session, java.lang.String algo, byte[] data)
Proves the public key identity by signing the given datajava.lang.String
toString()
-
-
-
Field Detail
-
agent
private final SshAgent agent
-
key
private final java.security.PublicKey key
-
comment
private final java.lang.String comment
-
-
Constructor Detail
-
KeyAgentIdentity
public KeyAgentIdentity(SshAgent agent, java.security.PublicKey key, java.lang.String comment)
-
-
Method Detail
-
getPublicKey
public java.security.PublicKey getPublicKey()
- Specified by:
getPublicKey
in interfacePublicKeyIdentity
- Returns:
- The
PublicKey
identity value
-
getComment
public java.lang.String getComment()
-
sign
public java.util.Map.Entry<java.lang.String,byte[]> sign(SessionContext session, java.lang.String algo, byte[] data) throws java.lang.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:
java.lang.Exception
- If failed to sign the data
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-