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()
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, LOADER
Modifier | Constructor and Description |
---|---|
protected |
AbstractGeneratorHostKeyProvider() |
Modifier and Type | Method and Description |
---|---|
void |
clearLoadedKeys() |
protected 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() |
protected KeyPair |
loadFromFile(String alg,
Path keyPath) |
List<KeyPair> |
loadKeys()
Load available keys.
|
protected KeyPair |
readKeyPair(Path keyPath,
OpenOption... options) |
protected KeyPair |
resolveKeyPair(Path keyPath) |
void |
setAlgorithm(String algorithm) |
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) |
getSimplifiedLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getKeyTypes, loadKey, wrap, wrap
iterableOf, iteratorOf, iteratorOf, multiProvider, multiProvider, resolveKeyIdentityProvider, wrapKeyPairs, wrapKeyPairs
public static final String DEFAULT_ALGORITHM
public static final boolean DEFAULT_ALLOWED_TO_OVERWRITE
public Path getPath()
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 void clearLoadedKeys()
public List<KeyPair> loadKeys()
KeyIdentityProvider
Iterable
instance of available keys - ignored if null
protected KeyPair resolveKeyPair(Path keyPath) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected KeyPair loadFromFile(String alg, Path keyPath) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected KeyPair readKeyPair(Path keyPath, OpenOption... options) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected 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–2019 The Apache Software Foundation. All rights reserved.