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 anSshAgentto generate the identity signature
-
-
Field Summary
Fields Modifier and Type Field Description private SshAgentagentprivate java.lang.Stringcommentprivate java.security.KeyPairkeyPairprivate java.security.KeyPairresolvedPair
-
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.StringgetComment()java.security.KeyPairgetKeyIdentity()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.StringtoString()
-
-
-
Field Detail
-
agent
private final SshAgent agent
-
keyPair
private final java.security.KeyPair keyPair
-
resolvedPair
private java.security.KeyPair resolvedPair
-
comment
private final java.lang.String comment
-
-
Constructor Detail
-
KeyAgentIdentity
public KeyAgentIdentity(SshAgent agent, java.security.PublicKey key, java.lang.String comment)
-
-
Method Detail
-
getKeyIdentity
public java.security.KeyPair getKeyIdentity()
- Specified by:
getKeyIdentityin interfacePublicKeyIdentity- Returns:
- The
KeyPairidentity 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:PublicKeyIdentityProves the public key identity by signing the given data- Specified by:
signin interfacePublicKeyIdentity- Parameters:
session- TheSessionContextfor calling this method - may benullif 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:
toStringin classjava.lang.Object
-
-