public abstract class AbstractGeneratorHostKeyProvider extends AbstractKeyPairProvider
KeyPair
which is generated the 1st time
loadKeys()
is called. If there is a file backing it up and the
file exists, the key is loaded from it. Otherwise a new key pair is
generated and saved (provided a path is configured and isOverwriteAllowed()
KeyPairProvider.Utils
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ALGORITHM |
static boolean |
DEFAULT_ALLOWED_TO_OVERWRITE |
log
ECDSA_SHA2_NISTP256, ECDSA_SHA2_NISTP384, ECDSA_SHA2_NISTP521, EMPTY_KEYPAIR_PROVIDER, SSH_DSS, SSH_ED25519, SSH_RSA
EMPTY_KEYS_PROVIDER
Modifier | Constructor and Description |
---|---|
protected |
AbstractGeneratorHostKeyProvider() |
Modifier and Type | Method and Description |
---|---|
protected abstract KeyPair |
doReadKeyPair(String resourceKey,
InputStream inputStream) |
protected abstract void |
doWriteKeyPair(String resourceKey,
KeyPair kp,
OutputStream outputStream) |
protected KeyPair |
generateKeyPair(String algorithm) |
String |
getAlgorithm() |
int |
getKeySize() |
AlgorithmParameterSpec |
getKeySpec() |
Path |
getPath() |
boolean |
isOverwriteAllowed() |
Iterable<KeyPair> |
loadKeys()
Load available keys.
|
protected KeyPair |
readKeyPair(Path keyPath,
OpenOption... options) |
void |
setAlgorithm(String algorithm) |
void |
setFile(File file) |
void |
setKeySize(int keySize) |
void |
setKeySpec(AlgorithmParameterSpec keySpec) |
void |
setOverwriteAllowed(boolean overwriteAllowed) |
void |
setPath(Path path) |
protected void |
writeKeyPair(KeyPair kp,
Path keyPath,
OpenOption... options) |
getKeyTypes, loadKey
public static final String DEFAULT_ALGORITHM
public static final boolean DEFAULT_ALLOWED_TO_OVERWRITE
public Path getPath()
public void setFile(File file)
public void setPath(Path path)
public String getAlgorithm()
public void setAlgorithm(String algorithm)
public int getKeySize()
public void setKeySize(int keySize)
public AlgorithmParameterSpec getKeySpec()
public void setKeySpec(AlgorithmParameterSpec keySpec)
public boolean isOverwriteAllowed()
public void setOverwriteAllowed(boolean overwriteAllowed)
public Iterable<KeyPair> loadKeys()
KeyIdentityProvider
Iterable
instance of available keys - ignored if null
protected KeyPair readKeyPair(Path keyPath, OpenOption... options) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected abstract KeyPair doReadKeyPair(String resourceKey, InputStream inputStream) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected void writeKeyPair(KeyPair kp, Path keyPath, OpenOption... options) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected abstract void doWriteKeyPair(String resourceKey, KeyPair kp, OutputStream outputStream) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected KeyPair generateKeyPair(String algorithm) throws GeneralSecurityException
GeneralSecurityException
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.