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 |
logECDSA_SHA2_NISTP256, ECDSA_SHA2_NISTP384, ECDSA_SHA2_NISTP521, EMPTY_KEYPAIR_PROVIDER, SSH_DSS, SSH_DSS_CERT, SSH_ECDSA_SHA2_NISTP256_CERT, SSH_ECDSA_SHA2_NISTP384_CERT, SSH_ECDSA_SHA2_NISTP521_CERT, SSH_ED25519, SSH_ED25519_CERT, SSH_RSA, SSH_RSA_CERTEMPTY_KEYS_PROVIDER| Modifier | Constructor and Description |
|---|---|
protected |
AbstractGeneratorHostKeyProvider() |
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetKeyTypes, loadKey, wrap, wrapexhaustCurrentIdentities, isEmpty, iterableOf, multiProvider, multiProvider, resolveKeyIdentityProvider, wrapKeyPairs, wrapKeyPairspublic 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 AlgorithmNameProviderpublic void setAlgorithm(String algorithm)
public int getKeySize()
getKeySize in interface KeySizeIndicatorpublic 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)
KeyIdentityProviderloadKeys in interface KeyIdentityProvidersession - 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 nullprotected Iterable<KeyPair> resolveKeyPairs(SessionContext session, Path keyPath) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionprotected Iterable<KeyPair> loadFromFile(SessionContext session, String alg, Path keyPath) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionprotected Iterable<KeyPair> readKeyPairs(SessionContext session, Path keyPath, OpenOption... options) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionprotected Iterable<KeyPair> doReadKeyPairs(SessionContext session, NamedResource resourceKey, InputStream inputStream) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionprotected void writeKeyPair(KeyPair kp, Path keyPath, OpenOption... options) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionprotected abstract void doWriteKeyPair(NamedResource resourceKey, KeyPair kp, OutputStream outputStream) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionprotected KeyPair generateKeyPair(String algorithm) throws GeneralSecurityException
GeneralSecurityExceptionCopyright © 2018–2021 The Apache Software Foundation. All rights reserved.