Class KeyPairIdentity
- java.lang.Object
-
- org.apache.sshd.client.auth.pubkey.KeyPairIdentity
-
- All Implemented Interfaces:
PublicKeyIdentity
public class KeyPairIdentity extends java.lang.Object implements PublicKeyIdentity
Uses aKeyPair
to generate the identity signature
-
-
Field Summary
Fields Modifier and Type Field Description private java.security.KeyPair
pair
private java.util.Collection<NamedFactory<Signature>>
signatureFactories
-
Constructor Summary
Constructors Constructor Description KeyPairIdentity(SignatureFactoriesManager primary, SignatureFactoriesManager secondary, java.security.KeyPair pair)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.security.PublicKey
getPublicKey()
byte[]
sign(SessionContext session, byte[] data)
Proves the public key identity by signing the given datajava.lang.String
toString()
-
-
-
Field Detail
-
pair
private final java.security.KeyPair pair
-
signatureFactories
private final java.util.Collection<NamedFactory<Signature>> signatureFactories
-
-
Constructor Detail
-
KeyPairIdentity
public KeyPairIdentity(SignatureFactoriesManager primary, SignatureFactoriesManager secondary, java.security.KeyPair pair)
-
-
Method Detail
-
getPublicKey
public java.security.PublicKey getPublicKey()
- Specified by:
getPublicKey
in interfacePublicKeyIdentity
- Returns:
- The
PublicKey
identity value
-
sign
public byte[] sign(SessionContext session, 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 contextdata
- Data to sign- Returns:
- 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
-
-