public abstract class AbstractGeneratorHostKeyProvider extends AbstractKeyPairProvider implements AlgorithmNameProvider, KeySizeIndicator
KeyPair
which is generated the 1st time
loadKeys(SessionContext)
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
Modifier | Constructor and Description |
---|---|
protected |
AbstractGeneratorHostKeyProvider() |
getSimplifiedLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getKeyTypes, loadKey, wrap, wrap
exhaustCurrentIdentities, isEmpty, iterableOf, 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()
getAlgorithm
in interface AlgorithmNameProvider
public void setAlgorithm(String algorithm)
public int getKeySize()
getKeySize
in interface KeySizeIndicator
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(SessionContext session)
KeyIdentityProvider
loadKeys
in interface KeyIdentityProvider
session
- The SessionContext
for invoking this load command - may
be null
if not invoked within a session context (e.g., offline tool or session unknown).Iterable
instance of available keys - ignored if null
protected Iterable<KeyPair> resolveKeyPairs(SessionContext session, Path keyPath) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected Iterable<KeyPair> loadFromFile(SessionContext session, String alg, Path keyPath) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected Iterable<KeyPair> readKeyPairs(SessionContext session, Path keyPath, OpenOption... options) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected Iterable<KeyPair> doReadKeyPairs(SessionContext session, NamedResource 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(NamedResource resourceKey, KeyPair kp, OutputStream outputStream) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected KeyPair generateKeyPair(String algorithm) throws GeneralSecurityException
GeneralSecurityException
Copyright © 2008–2022 The Apache Software Foundation. All rights reserved.