Class SimpleGeneratorHostKeyProvider
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.keyprovider.AbstractKeyPairProvider
-
- org.apache.sshd.server.keyprovider.AbstractGeneratorHostKeyProvider
-
- org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider
-
- All Implemented Interfaces:
AlgorithmNameProvider
,KeyIdentityProvider
,KeyPairProvider
,KeySizeIndicator
public class SimpleGeneratorHostKeyProvider extends AbstractGeneratorHostKeyProvider
A simple implementation of anAbstractGeneratorHostKeyProvider
that writes and reads host keys using the OpenSSH file format. Legacy keys written by earlier implementations used Java serialization. De-serializing is restricted to a small number of classes known to exist in serializedKeyPair
s.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
SimpleGeneratorHostKeyProvider.ValidatingObjectInputStream
-
Field Summary
-
Fields inherited from class org.apache.sshd.server.keyprovider.AbstractGeneratorHostKeyProvider
DEFAULT_ALGORITHM, DEFAULT_ALLOWED_TO_OVERWRITE
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.keyprovider.KeyIdentityProvider
EMPTY_KEYS_PROVIDER
-
Fields inherited from interface org.apache.sshd.common.keyprovider.KeyPairProvider
ECDSA_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_CERT
-
-
Constructor Summary
Constructors Constructor Description SimpleGeneratorHostKeyProvider()
SimpleGeneratorHostKeyProvider(java.nio.file.Path path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Iterable<java.security.KeyPair>
doReadKeyPairs(SessionContext session, NamedResource resourceKey, java.io.InputStream inputStream)
protected void
doWriteKeyPair(NamedResource resourceKey, java.security.KeyPair kp, java.io.OutputStream outputStream)
private boolean
isJavaSerialization(java.io.BufferedInputStream in, NamedResource resourceKey)
-
Methods inherited from class org.apache.sshd.server.keyprovider.AbstractGeneratorHostKeyProvider
clearLoadedKeys, generateKeyPair, getAlgorithm, getKeySize, getKeySpec, getPath, hasStrictFilePermissions, isOverwriteAllowed, loadFromFile, loadKeys, readKeyPairs, resolveKeyPairs, setAlgorithm, setFilePermissions, setKeySize, setKeySpec, setOverwriteAllowed, setPath, setStrictFilePermissions, writeKeyPair
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.keyprovider.KeyPairProvider
getKeyTypes, loadKey
-
-
-
-
Method Detail
-
doReadKeyPairs
protected java.lang.Iterable<java.security.KeyPair> doReadKeyPairs(SessionContext session, NamedResource resourceKey, java.io.InputStream inputStream) throws java.io.IOException, java.security.GeneralSecurityException
- Overrides:
doReadKeyPairs
in classAbstractGeneratorHostKeyProvider
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
isJavaSerialization
private boolean isJavaSerialization(java.io.BufferedInputStream in, NamedResource resourceKey) throws java.io.IOException
- Throws:
java.io.IOException
-
doWriteKeyPair
protected void doWriteKeyPair(NamedResource resourceKey, java.security.KeyPair kp, java.io.OutputStream outputStream) throws java.io.IOException, java.security.GeneralSecurityException
- Specified by:
doWriteKeyPair
in classAbstractGeneratorHostKeyProvider
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
-