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 |
logECDSA_SHA2_NISTP256, ECDSA_SHA2_NISTP384, ECDSA_SHA2_NISTP521, EMPTY_KEYPAIR_PROVIDER, SSH_DSS, SSH_RSA| 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, loadKeypublic 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()
KeyPairProviderIterable instance of available keys, never nullprotected KeyPair readKeyPair(Path keyPath, OpenOption... options) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionprotected abstract KeyPair doReadKeyPair(String resourceKey, InputStream inputStream) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionprotected void writeKeyPair(KeyPair kp, Path keyPath, OpenOption... options) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionprotected abstract void doWriteKeyPair(String resourceKey, KeyPair kp, OutputStream outputStream) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionprotected KeyPair generateKeyPair(String algorithm) throws GeneralSecurityException
GeneralSecurityExceptionCopyright © 2008–2015 The Apache Software Foundation. All rights reserved.