Class SshKeyPair
java.lang.Object
com.sshtools.common.ssh.components.SshKeyPair
- All Implemented Interfaces:
SignatureGenerator
- Direct Known Subclasses:
SshCertificate
Storage class for a public/private key pair.
- Author:
- Lee David Painter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic SshKeyPairgetKeyPair(SshPrivateKey prv, SshPublicKey pub) Wraps a public/private key pair into an SshKeyPair instance.Get the private key.Get the public key.List the public keys supported by this signature generator.inthashCode()voidsetPrivateKey(SshPrivateKey privatekey) Set the private keyvoidsetPublicKey(SshPublicKey publickey) Set the public keybyte[]sign(SshPublicKey key, String signingAlgorithm, byte[] data) Sign the data using the private key of the public key provided.
-
Constructor Details
-
SshKeyPair
public SshKeyPair()
-
-
Method Details
-
getPrivateKey
Get the private key.- Returns:
- SshPrivateKey
-
getPublicKey
Get the public key.- Returns:
- SshPublicKey
-
getKeyPair
Wraps a public/private key pair into an SshKeyPair instance.- Parameters:
prv-pub-- Returns:
- SshKeyPair
-
setPrivateKey
Set the private key- Parameters:
privatekey-
-
setPublicKey
Set the public key- Parameters:
publickey-
-
hashCode
public int hashCode() -
equals
-
sign
public byte[] sign(SshPublicKey key, String signingAlgorithm, byte[] data) throws SshException, IOException Description copied from interface:SignatureGeneratorSign the data using the private key of the public key provided.- Specified by:
signin interfaceSignatureGenerator- Returns:
- byte[]
- Throws:
IOExceptionSshException
-
getPublicKeys
Description copied from interface:SignatureGeneratorList the public keys supported by this signature generator.- Specified by:
getPublicKeysin interfaceSignatureGenerator- Returns:
- Throws:
IOException
-