[SSHD-842] Split common utilities code from sshd-core into sshd-common (new artifact)
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/10de190e Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/10de190e Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/10de190e Branch: refs/heads/master Commit: 10de190e7d3f9189deb76b8d08c72334a1fe2df0 Parents: 1e82547 Author: Goldstein Lyor <[email protected]> Authored: Wed Sep 5 18:05:53 2018 +0300 Committer: Lyor Goldstein <[email protected]> Committed: Thu Sep 6 19:07:54 2018 +0300 ---------------------------------------------------------------------- assembly/pom.xml | 5 + pom.xml | 1 + sshd-cli/pom.xml | 7 + .../java/org/apache/sshd/cli/CliSupport.java | 6 +- .../sshd/cli/client/SshClientCliSupport.java | 16 +- .../apache/sshd/cli/client/SshKeyScanMain.java | 4 +- .../sshd/cli/server/SshServerCliSupport.java | 4 +- .../apache/sshd/cli/server/SshServerMain.java | 5 +- .../apache/sshd/cli/server/SshFsMounter.java | 11 +- sshd-common/pom.xml | 128 ++ .../org/apache/sshd/sshd-version.properties | 23 + .../auth/AuthenticationIdentitiesProvider.java | 125 ++ .../auth/hostbased/HostKeyIdentityProvider.java | 53 + .../auth/password/PasswordIdentityProvider.java | 169 +++ .../client/auth/pubkey/PublicKeyIdentity.java | 42 + .../hosts/ConfigFileHostEntryResolver.java | 107 ++ .../DefaultConfigFileHostEntryResolver.java | 95 ++ .../client/config/hosts/HostConfigEntry.java | 1169 ++++++++++++++++++ .../config/hosts/HostConfigEntryResolver.java | 60 + .../client/config/hosts/HostPatternValue.java | 97 ++ .../client/config/hosts/HostPatternsHolder.java | 343 +++++ .../client/config/hosts/KnownHostDigest.java | 66 + .../client/config/hosts/KnownHostEntry.java | 276 +++++ .../client/config/hosts/KnownHostHashValue.java | 170 +++ .../keys/BuiltinClientIdentitiesWatcher.java | 106 ++ .../config/keys/ClientIdentitiesWatcher.java | 139 +++ .../sshd/client/config/keys/ClientIdentity.java | 268 ++++ .../config/keys/ClientIdentityFileWatcher.java | 141 +++ .../config/keys/ClientIdentityLoader.java | 95 ++ .../config/keys/ClientIdentityProvider.java | 42 + .../keys/DefaultClientIdentitiesWatcher.java | 66 + .../org/apache/sshd/common/AttributeStore.java | 97 ++ .../org/apache/sshd/common/BuiltinFactory.java | 40 + .../java/org/apache/sshd/common/Closeable.java | 126 ++ .../java/org/apache/sshd/common/Factory.java | 41 + .../org/apache/sshd/common/NamedFactory.java | 66 + .../org/apache/sshd/common/NamedResource.java | 104 ++ .../org/apache/sshd/common/OptionalFeature.java | 92 ++ .../apache/sshd/common/PropertyResolver.java | 124 ++ .../sshd/common/PropertyResolverUtils.java | 482 ++++++++ .../apache/sshd/common/RuntimeSshException.java | 48 + .../org/apache/sshd/common/SshConstants.java | 245 ++++ .../org/apache/sshd/common/SshException.java | 72 ++ .../apache/sshd/common/SyspropsMapWrapper.java | 209 ++++ .../sshd/common/auth/MutableUserHolder.java | 27 + .../apache/sshd/common/auth/UsernameHolder.java | 32 + .../apache/sshd/common/cipher/BaseCipher.java | 113 ++ .../sshd/common/cipher/BaseRC4Cipher.java | 54 + .../sshd/common/cipher/BuiltinCiphers.java | 348 ++++++ .../org/apache/sshd/common/cipher/Cipher.java | 89 ++ .../sshd/common/cipher/CipherFactory.java | 31 + .../sshd/common/cipher/CipherInformation.java | 45 + .../apache/sshd/common/cipher/CipherNone.java | 63 + .../org/apache/sshd/common/cipher/ECCurves.java | 580 +++++++++ .../org/apache/sshd/common/cipher/package.html | 26 + .../common/compression/BaseCompression.java | 48 + .../common/compression/BuiltinCompressions.java | 239 ++++ .../sshd/common/compression/Compression.java | 71 ++ .../compression/CompressionDelayedZlib.java | 40 + .../common/compression/CompressionFactory.java | 31 + .../compression/CompressionInformation.java | 42 + .../common/compression/CompressionNone.java | 76 ++ .../common/compression/CompressionZlib.java | 85 ++ .../apache/sshd/common/compression/package.html | 25 + .../common/config/CompressionConfigValue.java | 94 ++ .../common/config/ConfigFileReaderSupport.java | 230 ++++ .../common/config/FactoriesListParseResult.java | 51 + .../sshd/common/config/ListParseResult.java | 66 + .../sshd/common/config/LogLevelValue.java | 56 + .../config/NamedFactoriesListParseResult.java | 47 + .../config/NamedResourceListParseResult.java | 57 + .../sshd/common/config/SyslogFacilityValue.java | 51 + .../sshd/common/config/TimeValueConfig.java | 180 +++ .../sshd/common/config/VersionProperties.java | 98 ++ .../common/config/keys/AuthorizedKeyEntry.java | 480 +++++++ .../common/config/keys/BuiltinIdentities.java | 212 ++++ .../config/keys/FilePasswordProvider.java | 45 + .../sshd/common/config/keys/Identity.java | 42 + .../config/keys/IdentityResourceLoader.java | 49 + .../sshd/common/config/keys/IdentityUtils.java | 159 +++ .../common/config/keys/KeyEntryResolver.java | 190 +++ .../sshd/common/config/keys/KeyRandomArt.java | 310 +++++ .../sshd/common/config/keys/KeyUtils.java | 937 ++++++++++++++ .../config/keys/PrivateKeyEntryDecoder.java | 142 +++ .../config/keys/PrivateKeyEntryResolver.java | 70 ++ .../sshd/common/config/keys/PublicKeyEntry.java | 286 +++++ .../config/keys/PublicKeyEntryDecoder.java | 114 ++ .../config/keys/PublicKeyEntryResolver.java | 70 ++ .../impl/AbstractIdentityResourceLoader.java | 62 + .../keys/impl/AbstractKeyEntryResolver.java | 59 + .../impl/AbstractPrivateKeyEntryDecoder.java | 40 + .../impl/AbstractPublicKeyEntryDecoder.java | 41 + .../keys/impl/DSSPublicKeyEntryDecoder.java | 119 ++ .../keys/impl/ECDSAPublicKeyEntryDecoder.java | 178 +++ .../config/keys/impl/RSAPublicKeyDecoder.java | 117 ++ .../keys/loader/AESPrivateKeyObfuscator.java | 110 ++ .../loader/AbstractKeyPairResourceParser.java | 181 +++ .../loader/AbstractPrivateKeyObfuscator.java | 191 +++ .../keys/loader/DESPrivateKeyObfuscator.java | 76 ++ .../keys/loader/KeyPairResourceLoader.java | 129 ++ .../keys/loader/KeyPairResourceParser.java | 192 +++ .../loader/PrivateKeyEncryptionContext.java | 270 ++++ .../keys/loader/PrivateKeyObfuscator.java | 64 + .../OpenSSHDSSPrivateKeyEntryDecoder.java | 139 +++ .../OpenSSHECDSAPrivateKeyEntryDecoder.java | 164 +++ .../openssh/OpenSSHKeyPairResourceParser.java | 358 ++++++ .../loader/openssh/OpenSSHParserContext.java | 83 ++ .../openssh/OpenSSHRSAPrivateKeyDecoder.java | 135 ++ .../pem/AbstractPEMResourceKeyPairParser.java | 167 +++ .../loader/pem/DSSPEMResourceKeyPairParser.java | 126 ++ .../pem/ECDSAPEMResourceKeyPairParser.java | 220 ++++ .../loader/pem/KeyPairPEMResourceParser.java | 37 + .../keys/loader/pem/PEMResourceParserUtils.java | 109 ++ .../pem/PKCS8PEMResourceKeyPairParser.java | 156 +++ .../loader/pem/RSAPEMResourceKeyPairParser.java | 142 +++ .../apache/sshd/common/digest/BaseDigest.java | 156 +++ .../sshd/common/digest/BuiltinDigests.java | 166 +++ .../org/apache/sshd/common/digest/Digest.java | 36 + .../sshd/common/digest/DigestFactory.java | 32 + .../sshd/common/digest/DigestInformation.java | 36 + .../apache/sshd/common/digest/DigestUtils.java | 228 ++++ .../org/apache/sshd/common/digest/package.html | 25 + .../sshd/common/future/AbstractSshFuture.java | 194 +++ .../apache/sshd/common/future/CloseFuture.java | 40 + .../sshd/common/future/DefaultCloseFuture.java | 52 + .../sshd/common/future/DefaultSshFuture.java | 236 ++++ .../future/DefaultVerifiableSshFuture.java | 30 + .../apache/sshd/common/future/SshFuture.java | 48 + .../sshd/common/future/SshFutureListener.java | 42 + .../sshd/common/future/VerifiableFuture.java | 68 + .../sshd/common/future/WaitableFuture.java | 118 ++ .../keyprovider/AbstractKeyPairProvider.java | 32 + .../AbstractResourceKeyPairProvider.java | 234 ++++ .../ClassLoadableResourceKeyPairProvider.java | 113 ++ .../common/keyprovider/FileKeyPairProvider.java | 92 ++ .../common/keyprovider/KeyIdentityProvider.java | 170 +++ .../common/keyprovider/KeyPairProvider.java | 181 +++ .../keyprovider/KeyPairProviderHolder.java | 35 + .../keyprovider/MappedKeyPairProvider.java | 97 ++ .../org/apache/sshd/common/mac/BaseMac.java | 111 ++ .../org/apache/sshd/common/mac/BuiltinMacs.java | 273 ++++ .../java/org/apache/sshd/common/mac/Mac.java | 52 + .../org/apache/sshd/common/mac/MacFactory.java | 31 + .../apache/sshd/common/mac/MacInformation.java | 41 + .../org/apache/sshd/common/mac/package.html | 25 + .../sshd/common/random/AbstractRandom.java | 34 + .../common/random/AbstractRandomFactory.java | 43 + .../apache/sshd/common/random/JceRandom.java | 60 + .../sshd/common/random/JceRandomFactory.java | 42 + .../org/apache/sshd/common/random/Random.java | 56 + .../sshd/common/random/RandomFactory.java | 31 + .../common/random/SingletonRandomFactory.java | 70 ++ .../org/apache/sshd/common/random/package.html | 25 + .../common/signature/AbstractSignature.java | 149 +++ .../common/signature/BuiltinSignatures.java | 305 +++++ .../apache/sshd/common/signature/Signature.java | 88 ++ .../sshd/common/signature/SignatureDSA.java | 142 +++ .../sshd/common/signature/SignatureECDSA.java | 144 +++ .../signature/SignatureFactoriesManager.java | 94 ++ .../sshd/common/signature/SignatureFactory.java | 31 + .../sshd/common/signature/SignatureRSA.java | 89 ++ .../apache/sshd/common/signature/package.html | 25 + .../sshd/common/util/EventListenerUtils.java | 212 ++++ .../apache/sshd/common/util/EventNotifier.java | 35 + .../apache/sshd/common/util/GenericUtils.java | 915 ++++++++++++++ .../sshd/common/util/IgnoringEmptyMap.java | 128 ++ .../sshd/common/util/Int2IntFunction.java | 66 + .../org/apache/sshd/common/util/Invoker.java | 116 ++ .../apache/sshd/common/util/MapEntryUtils.java | 51 + .../apache/sshd/common/util/NumberUtils.java | 310 +++++ .../apache/sshd/common/util/ObjectBuilder.java | 38 + .../org/apache/sshd/common/util/OsUtils.java | 257 ++++ .../org/apache/sshd/common/util/Readable.java | 53 + .../sshd/common/util/ReflectionUtils.java | 53 + .../apache/sshd/common/util/SelectorUtils.java | 805 ++++++++++++ .../sshd/common/util/SshdEventListener.java | 44 + .../apache/sshd/common/util/ValidateUtils.java | 216 ++++ .../apache/sshd/common/util/VersionInfo.java | 137 ++ .../apache/sshd/common/util/buffer/Buffer.java | 798 ++++++++++++ .../common/util/buffer/BufferException.java | 30 + .../sshd/common/util/buffer/BufferUtils.java | 604 +++++++++ .../common/util/buffer/ByteArrayBuffer.java | 253 ++++ .../keys/AbstractBufferPublicKeyParser.java | 88 ++ .../util/buffer/keys/BufferPublicKeyParser.java | 111 ++ .../buffer/keys/DSSBufferPublicKeyParser.java | 52 + .../buffer/keys/ECBufferPublicKeyParser.java | 81 ++ .../keys/ED25519BufferPublicKeyParser.java | 47 + .../buffer/keys/RSABufferPublicKeyParser.java | 49 + .../util/closeable/AbstractCloseable.java | 162 +++ .../util/closeable/AbstractInnerCloseable.java | 48 + .../sshd/common/util/closeable/Builder.java | 115 ++ .../common/util/closeable/FuturesCloseable.java | 76 ++ .../common/util/closeable/IoBaseCloseable.java | 35 + .../util/closeable/ParallelCloseable.java | 73 ++ .../util/closeable/SequentialCloseable.java | 71 ++ .../common/util/closeable/SimpleCloseable.java | 71 ++ .../util/io/CloseableEmptyInputStream.java | 96 ++ .../sshd/common/util/io/DirectoryScanner.java | 380 ++++++ .../sshd/common/util/io/EmptyInputStream.java | 66 + .../sshd/common/util/io/FileInfoExtractor.java | 53 + .../common/util/io/InputStreamWithChannel.java | 32 + .../org/apache/sshd/common/util/io/IoUtils.java | 556 +++++++++ .../sshd/common/util/io/LimitInputStream.java | 113 ++ .../util/io/LoggingFilterOutputStream.java | 67 + .../common/util/io/ModifiableFileWatcher.java | 258 ++++ .../sshd/common/util/io/NoCloseInputStream.java | 47 + .../common/util/io/NoCloseOutputStream.java | 47 + .../sshd/common/util/io/NoCloseReader.java | 46 + .../sshd/common/util/io/NoCloseWriter.java | 46 + .../sshd/common/util/io/NullInputStream.java | 90 ++ .../sshd/common/util/io/NullOutputStream.java | 72 ++ .../common/util/io/OutputStreamWithChannel.java | 32 + .../sshd/common/util/io/der/ASN1Class.java | 93 ++ .../sshd/common/util/io/der/ASN1Object.java | 338 +++++ .../sshd/common/util/io/der/ASN1Type.java | 118 ++ .../sshd/common/util/io/der/DERParser.java | 151 +++ .../sshd/common/util/io/der/DERWriter.java | 172 +++ .../common/util/io/functors/IOFunction.java | 86 ++ .../util/logging/AbstractLoggingBean.java | 72 ++ .../sshd/common/util/logging/LoggingUtils.java | 549 ++++++++ .../sshd/common/util/logging/SimplifiedLog.java | 55 + .../sshd/common/util/net/NetworkConnector.java | 90 ++ .../sshd/common/util/net/SshdSocketAddress.java | 639 ++++++++++ .../AbstractSecurityProviderRegistrar.java | 129 ++ .../util/security/SecurityEntityFactory.java | 194 +++ .../util/security/SecurityProviderChoice.java | 130 ++ .../security/SecurityProviderRegistrar.java | 337 +++++ .../common/util/security/SecurityUtils.java | 759 ++++++++++++ .../BouncyCastleGeneratorHostKeyProvider.java | 48 + .../BouncyCastleKeyPairResourceParser.java | 130 ++ .../bouncycastle/BouncyCastleRandom.java | 88 ++ .../bouncycastle/BouncyCastleRandomFactory.java | 45 + .../BouncyCastleSecurityProviderRegistrar.java | 128 ++ .../security/eddsa/Ed25519PublicKeyDecoder.java | 97 ++ .../eddsa/EdDSASecurityProviderRegistrar.java | 104 ++ .../eddsa/EdDSASecurityProviderUtils.java | 201 +++ .../OpenSSHEd25519PrivateKeyEntryDecoder.java | 172 +++ .../util/security/eddsa/SignatureEd25519.java | 49 + .../util/threads/CloseableExecutorService.java | 28 + .../util/threads/ExecutorServiceCarrier.java | 31 + .../common/util/threads/NoCloseExecutor.java | 160 +++ .../util/threads/SshThreadPoolExecutor.java | 138 +++ .../common/util/threads/SshdThreadFactory.java | 78 ++ .../sshd/common/util/threads/ThreadUtils.java | 185 +++ .../AbstractGeneratorHostKeyProvider.java | 293 +++++ .../SimpleGeneratorHostKeyProvider.java | 67 + .../password/PasswordIdentityProviderTest.java | 72 ++ .../hosts/ConfigFileHostEntryResolverTest.java | 139 +++ .../config/hosts/HostConfigEntryTest.java | 325 +++++ .../config/hosts/KnownHostHashValueTest.java | 79 ++ .../BuiltinClientIdentitiesWatcherTest.java | 161 +++ .../keys/ClientIdentityFileWatcherTest.java | 121 ++ .../client/config/keys/ClientIdentityTest.java | 100 ++ .../apache/sshd/common/SshConstantsTest.java | 75 ++ .../sshd/common/VersionPropertiesTest.java | 45 + .../sshd/common/cipher/AES192CTRTest.java | 41 + .../sshd/common/cipher/AES256CBCTest.java | 41 + .../sshd/common/cipher/ARCFOUR128Test.java | 39 + .../sshd/common/cipher/ARCFOUR256Test.java | 41 + .../sshd/common/cipher/BaseCipherTest.java | 95 ++ .../apache/sshd/common/cipher/ECCurvesTest.java | 107 ++ .../compression/BuiltinCompressionsTest.java | 171 +++ .../sshd/common/config/TimeValueConfigTest.java | 57 + ...AuthorizedKeyEntryLoginOptionsParseTest.java | 124 ++ .../config/keys/BuiltinIdentitiesTest.java | 116 ++ .../common/config/keys/KeyRandomArtTest.java | 117 ++ .../common/config/keys/KeyUtilsCloneTest.java | 120 ++ .../KeyUtilsFingerprintCaseSensitivityTest.java | 96 ++ .../keys/KeyUtilsFingerprintGenerationTest.java | 159 +++ .../sshd/common/config/keys/KeyUtilsTest.java | 157 +++ .../common/config/keys/PublicKeyEntryTest.java | 62 + .../loader/AESPrivateKeyObfuscatorTest.java | 79 ++ .../OpenSSHKeyPairResourceParserTest.java | 108 ++ .../pem/PKCS8PEMResourceKeyPairParserTest.java | 107 ++ .../sshd/common/digest/BuiltinDigestsTest.java | 65 + .../common/future/DefaultSshFutureTest.java | 137 ++ .../common/keyprovider/KeyPairProviderTest.java | 79 ++ .../apache/sshd/common/mac/BuiltinMacsTest.java | 166 +++ .../apache/sshd/common/mac/MacVectorsTest.java | 311 +++++ .../sshd/common/random/RandomFactoryTest.java | 83 ++ .../common/signature/BuiltinSignaturesTest.java | 149 +++ .../sshd/common/signature/SignatureDSATest.java | 109 ++ .../sshd/common/signature/SignatureRSATest.java | 119 ++ .../common/signature/SignaturesDevelopment.java | 81 ++ .../common/util/EventListenerUtilsTest.java | 149 +++ .../sshd/common/util/GenericUtilsTest.java | 173 +++ .../sshd/common/util/Int2IntFunctionTest.java | 154 +++ .../sshd/common/util/NumberUtilsTest.java | 77 ++ .../apache/sshd/common/util/OsUtilsTest.java | 135 ++ .../sshd/common/util/SelectorUtilsTest.java | 147 +++ .../sshd/common/util/ThreadUtilsTest.java | 72 ++ .../sshd/common/util/ValidateUtilsTest.java | 44 + .../sshd/common/util/VersionInfoTest.java | 52 + .../sshd/common/util/buffer/BufferTest.java | 103 ++ .../common/util/buffer/BufferUtilsTest.java | 73 ++ .../util/closeable/CloseableUtilsTest.java | 163 +++ .../common/util/io/EmptyInputStreamTest.java | 120 ++ .../apache/sshd/common/util/io/IoUtilsTest.java | 61 + .../common/util/io/LimitInputStreamTest.java | 118 ++ .../util/io/ModifiableFileWatcherTest.java | 82 ++ .../common/util/io/NoCloseInputStreamTest.java | 89 ++ .../common/util/io/NoCloseOutputStreamTest.java | 69 ++ .../sshd/common/util/io/NoCloseReaderTest.java | 95 ++ .../sshd/common/util/io/NoCloseWriterTest.java | 73 ++ .../common/util/io/NullInputStreamTest.java | 118 ++ .../common/util/io/NullOutputStreamTest.java | 80 ++ .../sshd/common/util/io/der/ASN1ClassTest.java | 67 + .../sshd/common/util/io/der/ASN1TypeTest.java | 67 + .../sshd/common/util/io/der/DERParserTest.java | 61 + .../sshd/common/util/io/der/DERWriterTest.java | 64 + .../util/net/SshdSocketIpv6AddressTest.java | 88 ++ ...SecurityProviderRegistrarCipherNameTest.java | 75 ++ .../SecurityProviderRegistrarTestSupport.java | 62 + .../common/util/security/SecurityUtilsTest.java | 231 ++++ .../util/security/eddsa/EDDSAProviderTest.java | 126 ++ .../util/security/eddsa/Ed25519VectorsTest.java | 238 ++++ .../EdDSASecurityProviderRegistrarTest.java | 85 ++ .../AbstractGeneratorHostKeyProviderTest.java | 83 ++ .../PEMGeneratorHostKeyProviderTest.java | 141 +++ .../SimpleGeneratorHostKeyProviderTest.java | 133 ++ .../sshd/util/test/CommonTestSupportUtils.java | 620 ++++++++++ .../test/JUnit4ClassRunnerWithParameters.java | 48 + .../JUnit4ClassRunnerWithParametersFactory.java | 58 + .../test/JUnit4SingleInstanceClassRunner.java | 54 + .../apache/sshd/util/test/JUnitTestSupport.java | 572 +++++++++ .../org/apache/sshd/util/test/NoIoTestCase.java | 30 + .../test/OutputCountTrackingOutputStream.java | 56 + .../apache/sshd/util/test/TeeOutputStream.java | 64 + sshd-common/src/test/resources/log4j.properties | 38 + .../testReadGlobalHostsConfigEntries.config.txt | 22 + .../testReadMultipleHostPatterns.config.txt | 5 + .../testReadSimpleHostsConfigEntries.config.txt | 8 + .../org/apache/sshd/client/config/keys/id_dsa | 12 + .../org/apache/sshd/client/config/keys/id_ecdsa | 5 + .../org/apache/sshd/client/config/keys/id_rsa | 27 + ...OpenSSHKeyPairResourceParserTest-DSA-KeyPair | 21 + ...SSHKeyPairResourceParserTest-DSA-KeyPair.pub | 1 + ...enSSHKeyPairResourceParserTest-ECDSA-KeyPair | 12 + ...HKeyPairResourceParserTest-ECDSA-KeyPair.pub | 1 + ...SSHKeyPairResourceParserTest-ED25519-KeyPair | 7 + ...eyPairResourceParserTest-ED25519-KeyPair.pub | 1 + ...OpenSSHKeyPairResourceParserTest-RSA-KeyPair | 49 + ...SSHKeyPairResourceParserTest-RSA-KeyPair.pub | 1 + .../EDDSAProviderTest-EDDSA-OpenSSH-KeyPair | 7 + .../EDDSAProviderTest-EDDSA-OpenSSH-KeyPair.pub | 1 + .../util/security/SecurityUtilsTest-DSA-KeyPair | 12 + .../security/SecurityUtilsTest-DSA-KeyPair.pub | 1 + .../security/SecurityUtilsTest-EC-256-KeyPair | 5 + .../SecurityUtilsTest-EC-256-KeyPair.pub | 1 + .../security/SecurityUtilsTest-EC-384-KeyPair | 6 + .../SecurityUtilsTest-EC-384-KeyPair.pub | 1 + .../security/SecurityUtilsTest-EC-521-KeyPair | 7 + .../SecurityUtilsTest-EC-521-KeyPair.pub | 1 + .../util/security/SecurityUtilsTest-RSA-KeyPair | 27 + .../security/SecurityUtilsTest-RSA-KeyPair.pub | 1 + .../super-secret-passphrase-RSA-AES-128-key | 30 + .../super-secret-passphrase-RSA-AES-128-key.pub | 1 + .../super-secret-passphrase-RSA-AES-192-key | 30 + .../super-secret-passphrase-RSA-AES-192-key.pub | 1 + .../super-secret-passphrase-RSA-AES-256-key | 30 + .../super-secret-passphrase-RSA-AES-256-key.pub | 1 + .../super-secret-passphrase-RSA-DES-EDE3-key | 30 + ...super-secret-passphrase-RSA-DES-EDE3-key.pub | 1 + sshd-contrib/pom.xml | 9 +- ...SimpleAccessControlScpEventListenerTest.java | 8 +- ...impleAccessControlSftpEventListenerTest.java | 12 +- sshd-core/pom.xml | 19 +- .../org/apache/sshd/sshd-version.properties | 23 - .../java/org/apache/sshd/client/SshClient.java | 60 + .../auth/AuthenticationIdentitiesProvider.java | 125 -- .../auth/hostbased/HostKeyIdentityProvider.java | 53 - .../keyboard/UserAuthKeyboardInteractive.java | 3 +- .../auth/password/PasswordIdentityProvider.java | 183 --- .../client/auth/password/UserAuthPassword.java | 2 +- .../client/auth/pubkey/PublicKeyIdentity.java | 42 - .../auth/pubkey/UserAuthPublicKeyIterator.java | 2 +- .../config/SshClientConfigFileReader.java | 3 +- .../hosts/ConfigFileHostEntryResolver.java | 107 -- .../DefaultConfigFileHostEntryResolver.java | 95 -- .../client/config/hosts/HostConfigEntry.java | 1169 ------------------ .../config/hosts/HostConfigEntryResolver.java | 60 - .../client/config/hosts/HostPatternValue.java | 97 -- .../client/config/hosts/HostPatternsHolder.java | 343 ----- .../client/config/hosts/KnownHostDigest.java | 66 - .../client/config/hosts/KnownHostEntry.java | 276 ----- .../client/config/hosts/KnownHostHashValue.java | 170 --- .../keys/BuiltinClientIdentitiesWatcher.java | 106 -- .../config/keys/ClientIdentitiesWatcher.java | 139 --- .../sshd/client/config/keys/ClientIdentity.java | 325 ----- .../config/keys/ClientIdentityFileWatcher.java | 141 --- .../config/keys/ClientIdentityLoader.java | 95 -- .../config/keys/ClientIdentityProvider.java | 42 - .../keys/DefaultClientIdentitiesWatcher.java | 66 - .../KnownHostsServerKeyVerifier.java | 6 +- .../sshd/client/session/ClientSession.java | 54 + .../client/simple/SimpleClientConfigurator.java | 4 +- .../org/apache/sshd/common/AttributeStore.java | 152 --- .../org/apache/sshd/common/BuiltinFactory.java | 40 - .../java/org/apache/sshd/common/Closeable.java | 126 -- .../java/org/apache/sshd/common/Factory.java | 41 - .../org/apache/sshd/common/FactoryManager.java | 16 + .../org/apache/sshd/common/NamedFactory.java | 66 - .../org/apache/sshd/common/NamedResource.java | 104 -- .../org/apache/sshd/common/OptionalFeature.java | 92 -- .../apache/sshd/common/PropertyResolver.java | 124 -- .../sshd/common/PropertyResolverUtils.java | 482 -------- .../apache/sshd/common/RuntimeSshException.java | 48 - .../org/apache/sshd/common/SshConstants.java | 245 ---- .../org/apache/sshd/common/SshException.java | 72 -- .../apache/sshd/common/SyspropsMapWrapper.java | 209 ---- .../sshd/common/auth/MutableUserHolder.java | 27 - .../apache/sshd/common/auth/UsernameHolder.java | 32 - .../sshd/common/channel/AbstractChannel.java | 6 - .../org/apache/sshd/common/channel/Channel.java | 26 + .../apache/sshd/common/cipher/BaseCipher.java | 113 -- .../sshd/common/cipher/BaseRC4Cipher.java | 54 - .../sshd/common/cipher/BuiltinCiphers.java | 348 ------ .../org/apache/sshd/common/cipher/Cipher.java | 89 -- .../sshd/common/cipher/CipherFactory.java | 31 - .../sshd/common/cipher/CipherInformation.java | 45 - .../apache/sshd/common/cipher/CipherNone.java | 63 - .../org/apache/sshd/common/cipher/ECCurves.java | 580 --------- .../org/apache/sshd/common/cipher/package.html | 26 - .../common/compression/BaseCompression.java | 48 - .../common/compression/BuiltinCompressions.java | 239 ---- .../sshd/common/compression/Compression.java | 71 -- .../compression/CompressionDelayedZlib.java | 40 - .../common/compression/CompressionFactory.java | 31 - .../compression/CompressionInformation.java | 42 - .../common/compression/CompressionNone.java | 76 -- .../common/compression/CompressionZlib.java | 85 -- .../apache/sshd/common/compression/package.html | 25 - .../common/config/CompressionConfigValue.java | 94 -- .../common/config/FactoriesListParseResult.java | 51 - .../sshd/common/config/ListParseResult.java | 66 - .../sshd/common/config/LogLevelValue.java | 56 - .../config/NamedFactoriesListParseResult.java | 47 - .../config/NamedResourceListParseResult.java | 57 - .../sshd/common/config/SshConfigFileReader.java | 268 +--- .../sshd/common/config/SyslogFacilityValue.java | 51 - .../sshd/common/config/TimeValueConfig.java | 180 --- .../sshd/common/config/VersionProperties.java | 98 -- .../common/config/keys/AuthorizedKeyEntry.java | 492 -------- .../common/config/keys/BuiltinIdentities.java | 212 ---- .../config/keys/FilePasswordProvider.java | 45 - .../sshd/common/config/keys/Identity.java | 42 - .../config/keys/IdentityResourceLoader.java | 49 - .../sshd/common/config/keys/IdentityUtils.java | 159 --- .../common/config/keys/KeyEntryResolver.java | 190 --- .../sshd/common/config/keys/KeyRandomArt.java | 310 ----- .../sshd/common/config/keys/KeyUtils.java | 937 -------------- .../config/keys/PrivateKeyEntryDecoder.java | 142 --- .../config/keys/PrivateKeyEntryResolver.java | 70 -- .../sshd/common/config/keys/PublicKeyEntry.java | 286 ----- .../config/keys/PublicKeyEntryDecoder.java | 114 -- .../config/keys/PublicKeyEntryResolver.java | 70 -- .../impl/AbstractIdentityResourceLoader.java | 62 - .../keys/impl/AbstractKeyEntryResolver.java | 59 - .../impl/AbstractPrivateKeyEntryDecoder.java | 40 - .../impl/AbstractPublicKeyEntryDecoder.java | 41 - .../keys/impl/DSSPublicKeyEntryDecoder.java | 119 -- .../keys/impl/ECDSAPublicKeyEntryDecoder.java | 178 --- .../config/keys/impl/RSAPublicKeyDecoder.java | 117 -- .../keys/loader/AESPrivateKeyObfuscator.java | 110 -- .../loader/AbstractKeyPairResourceParser.java | 181 --- .../loader/AbstractPrivateKeyObfuscator.java | 191 --- .../keys/loader/DESPrivateKeyObfuscator.java | 76 -- .../keys/loader/KeyPairResourceLoader.java | 129 -- .../keys/loader/KeyPairResourceParser.java | 192 --- .../loader/PrivateKeyEncryptionContext.java | 270 ---- .../keys/loader/PrivateKeyObfuscator.java | 64 - .../OpenSSHDSSPrivateKeyEntryDecoder.java | 139 --- .../OpenSSHECDSAPrivateKeyEntryDecoder.java | 164 --- .../openssh/OpenSSHKeyPairResourceParser.java | 358 ------ .../loader/openssh/OpenSSHParserContext.java | 83 -- .../openssh/OpenSSHRSAPrivateKeyDecoder.java | 135 -- .../pem/AbstractPEMResourceKeyPairParser.java | 167 --- .../loader/pem/DSSPEMResourceKeyPairParser.java | 126 -- .../pem/ECDSAPEMResourceKeyPairParser.java | 220 ---- .../loader/pem/KeyPairPEMResourceParser.java | 37 - .../keys/loader/pem/PEMResourceParserUtils.java | 109 -- .../pem/PKCS8PEMResourceKeyPairParser.java | 156 --- .../loader/pem/RSAPEMResourceKeyPairParser.java | 142 --- .../apache/sshd/common/digest/BaseDigest.java | 156 --- .../sshd/common/digest/BuiltinDigests.java | 166 --- .../org/apache/sshd/common/digest/Digest.java | 36 - .../sshd/common/digest/DigestFactory.java | 32 - .../sshd/common/digest/DigestInformation.java | 36 - .../apache/sshd/common/digest/DigestUtils.java | 228 ---- .../org/apache/sshd/common/digest/package.html | 25 - .../sshd/common/future/AbstractSshFuture.java | 194 --- .../apache/sshd/common/future/CloseFuture.java | 40 - .../sshd/common/future/DefaultCloseFuture.java | 52 - .../sshd/common/future/DefaultSshFuture.java | 236 ---- .../future/DefaultVerifiableSshFuture.java | 30 - .../apache/sshd/common/future/SshFuture.java | 48 - .../sshd/common/future/SshFutureListener.java | 42 - .../sshd/common/future/VerifiableFuture.java | 68 - .../sshd/common/future/WaitableFuture.java | 118 -- .../common/helpers/AbstractFactoryManager.java | 6 - .../keyprovider/AbstractKeyPairProvider.java | 32 - .../AbstractResourceKeyPairProvider.java | 234 ---- .../ClassLoadableResourceKeyPairProvider.java | 113 -- .../common/keyprovider/FileKeyPairProvider.java | 92 -- .../common/keyprovider/KeyIdentityProvider.java | 204 --- .../common/keyprovider/KeyPairProvider.java | 181 --- .../keyprovider/KeyPairProviderHolder.java | 35 - .../keyprovider/MappedKeyPairProvider.java | 97 -- .../org/apache/sshd/common/mac/BaseMac.java | 111 -- .../org/apache/sshd/common/mac/BuiltinMacs.java | 273 ---- .../java/org/apache/sshd/common/mac/Mac.java | 52 - .../org/apache/sshd/common/mac/MacFactory.java | 31 - .../apache/sshd/common/mac/MacInformation.java | 41 - .../org/apache/sshd/common/mac/package.html | 25 - .../sshd/common/random/AbstractRandom.java | 34 - .../common/random/AbstractRandomFactory.java | 43 - .../apache/sshd/common/random/JceRandom.java | 60 - .../sshd/common/random/JceRandomFactory.java | 42 - .../org/apache/sshd/common/random/Random.java | 56 - .../sshd/common/random/RandomFactory.java | 31 - .../common/random/SingletonRandomFactory.java | 70 -- .../org/apache/sshd/common/random/package.html | 25 - .../org/apache/sshd/common/session/Session.java | 27 + .../common/session/helpers/AbstractSession.java | 6 - .../common/signature/AbstractSignature.java | 149 --- .../common/signature/BuiltinSignatures.java | 305 ----- .../apache/sshd/common/signature/Signature.java | 88 -- .../sshd/common/signature/SignatureDSA.java | 142 --- .../sshd/common/signature/SignatureECDSA.java | 144 --- .../signature/SignatureFactoriesManager.java | 94 -- .../sshd/common/signature/SignatureFactory.java | 31 - .../sshd/common/signature/SignatureRSA.java | 89 -- .../apache/sshd/common/signature/package.html | 25 - .../sshd/common/util/EventListenerUtils.java | 212 ---- .../apache/sshd/common/util/EventNotifier.java | 35 - .../apache/sshd/common/util/GenericUtils.java | 915 -------------- .../sshd/common/util/IgnoringEmptyMap.java | 128 -- .../sshd/common/util/Int2IntFunction.java | 66 - .../org/apache/sshd/common/util/Invoker.java | 116 -- .../apache/sshd/common/util/MapEntryUtils.java | 51 - .../apache/sshd/common/util/NumberUtils.java | 313 ----- .../apache/sshd/common/util/ObjectBuilder.java | 38 - .../org/apache/sshd/common/util/OsUtils.java | 257 ---- .../org/apache/sshd/common/util/Readable.java | 53 - .../sshd/common/util/ReflectionUtils.java | 53 - .../apache/sshd/common/util/SelectorUtils.java | 805 ------------ .../sshd/common/util/SshdEventListener.java | 44 - .../apache/sshd/common/util/ValidateUtils.java | 216 ---- .../apache/sshd/common/util/VersionInfo.java | 137 -- .../apache/sshd/common/util/buffer/Buffer.java | 798 ------------ .../common/util/buffer/BufferException.java | 30 - .../sshd/common/util/buffer/BufferUtils.java | 604 --------- .../common/util/buffer/ByteArrayBuffer.java | 253 ---- .../keys/AbstractBufferPublicKeyParser.java | 88 -- .../util/buffer/keys/BufferPublicKeyParser.java | 111 -- .../buffer/keys/DSSBufferPublicKeyParser.java | 52 - .../buffer/keys/ECBufferPublicKeyParser.java | 81 -- .../keys/ED25519BufferPublicKeyParser.java | 47 - .../buffer/keys/RSABufferPublicKeyParser.java | 49 - .../util/closeable/AbstractCloseable.java | 162 --- .../util/closeable/AbstractInnerCloseable.java | 48 - .../sshd/common/util/closeable/Builder.java | 115 -- .../common/util/closeable/FuturesCloseable.java | 76 -- .../common/util/closeable/IoBaseCloseable.java | 35 - .../util/closeable/ParallelCloseable.java | 73 -- .../util/closeable/SequentialCloseable.java | 71 -- .../common/util/closeable/SimpleCloseable.java | 71 -- .../util/io/CloseableEmptyInputStream.java | 96 -- .../sshd/common/util/io/DirectoryScanner.java | 380 ------ .../sshd/common/util/io/EmptyInputStream.java | 66 - .../sshd/common/util/io/FileInfoExtractor.java | 53 - .../common/util/io/InputStreamWithChannel.java | 32 - .../org/apache/sshd/common/util/io/IoUtils.java | 556 --------- .../sshd/common/util/io/LimitInputStream.java | 113 -- .../util/io/LoggingFilterOutputStream.java | 67 - .../common/util/io/ModifiableFileWatcher.java | 258 ---- .../sshd/common/util/io/NoCloseInputStream.java | 47 - .../common/util/io/NoCloseOutputStream.java | 47 - .../sshd/common/util/io/NoCloseReader.java | 46 - .../sshd/common/util/io/NoCloseWriter.java | 46 - .../sshd/common/util/io/NullInputStream.java | 90 -- .../sshd/common/util/io/NullOutputStream.java | 72 -- .../common/util/io/OutputStreamWithChannel.java | 32 - .../sshd/common/util/io/der/ASN1Class.java | 93 -- .../sshd/common/util/io/der/ASN1Object.java | 338 ----- .../sshd/common/util/io/der/ASN1Type.java | 118 -- .../sshd/common/util/io/der/DERParser.java | 151 --- .../sshd/common/util/io/der/DERWriter.java | 172 --- .../common/util/io/functors/IOFunction.java | 86 -- .../util/logging/AbstractLoggingBean.java | 72 -- .../sshd/common/util/logging/LoggingUtils.java | 549 -------- .../sshd/common/util/logging/SimplifiedLog.java | 55 - .../sshd/common/util/net/NetworkConnector.java | 90 -- .../sshd/common/util/net/SshdSocketAddress.java | 639 ---------- .../AbstractSecurityProviderRegistrar.java | 129 -- .../util/security/SecurityEntityFactory.java | 194 --- .../util/security/SecurityProviderChoice.java | 130 -- .../security/SecurityProviderRegistrar.java | 337 ----- .../common/util/security/SecurityUtils.java | 759 ------------ .../BouncyCastleGeneratorHostKeyProvider.java | 48 - .../BouncyCastleKeyPairResourceParser.java | 130 -- .../bouncycastle/BouncyCastleRandom.java | 88 -- .../bouncycastle/BouncyCastleRandomFactory.java | 45 - .../BouncyCastleSecurityProviderRegistrar.java | 128 -- .../security/eddsa/Ed25519PublicKeyDecoder.java | 97 -- .../eddsa/EdDSASecurityProviderRegistrar.java | 104 -- .../eddsa/EdDSASecurityProviderUtils.java | 201 --- .../OpenSSHEd25519PrivateKeyEntryDecoder.java | 172 --- .../util/security/eddsa/SignatureEd25519.java | 49 - .../util/threads/CloseableExecutorService.java | 28 - .../util/threads/ExecutorServiceCarrier.java | 31 - .../common/util/threads/NoCloseExecutor.java | 160 --- .../util/threads/SshThreadPoolExecutor.java | 138 --- .../common/util/threads/SshdThreadFactory.java | 78 -- .../sshd/common/util/threads/ThreadUtils.java | 185 --- .../auth/pubkey/PublickeyAuthenticator.java | 17 + .../config/SshServerConfigFileReader.java | 22 +- .../keys/AuthorizedKeysAuthenticator.java | 4 +- .../AbstractGeneratorHostKeyProvider.java | 293 ----- .../SimpleGeneratorHostKeyProvider.java | 67 - .../java/org/apache/sshd/KeepAliveTest.java | 6 +- .../java/org/apache/sshd/agent/AgentTest.java | 4 +- .../sshd/client/ClientSessionListenerTest.java | 6 +- .../auth/PasswordIdentityProviderTest.java | 73 -- .../sshd/client/channel/ChannelExecTest.java | 6 +- .../hosts/ConfigFileHostEntryResolverTest.java | 139 --- .../hosts/HostConfigEntryResolverTest.java | 11 +- .../config/hosts/HostConfigEntryTest.java | 325 ----- .../config/hosts/KnownHostHashValueTest.java | 79 -- .../BuiltinClientIdentitiesWatcherTest.java | 161 --- .../keys/ClientIdentityFileWatcherTest.java | 121 -- .../client/config/keys/ClientIdentityTest.java | 100 -- .../org/apache/sshd/client/kex/KexTest.java | 6 +- .../KnownHostsServerKeyVerifierTest.java | 6 +- .../sshd/client/session/ClientSessionTest.java | 6 +- .../client/simple/SimpleSessionClientTest.java | 6 +- .../apache/sshd/common/AttributeStoreTest.java | 24 +- .../sshd/common/PropertyResolverUtilsTest.java | 24 +- .../apache/sshd/common/SshConstantsTest.java | 75 -- .../sshd/common/VersionPropertiesTest.java | 45 - .../sshd/common/auth/AuthenticationTest.java | 18 +- .../sshd/common/cipher/AES192CTRTest.java | 41 - .../sshd/common/cipher/AES256CBCTest.java | 41 - .../sshd/common/cipher/ARCFOUR128Test.java | 39 - .../sshd/common/cipher/ARCFOUR256Test.java | 41 - .../sshd/common/cipher/BaseCipherTest.java | 95 -- .../apache/sshd/common/cipher/CipherTest.java | 25 +- .../apache/sshd/common/cipher/ECCurvesTest.java | 107 -- .../compression/BuiltinCompressionsTest.java | 171 --- .../common/compression/CompressionTest.java | 7 +- .../common/config/SshConfigFileReaderTest.java | 39 +- .../sshd/common/config/TimeValueConfigTest.java | 57 - ...AuthorizedKeyEntryLoginOptionsParseTest.java | 124 -- .../config/keys/AuthorizedKeyEntryTest.java | 6 +- .../config/keys/BuiltinIdentitiesTest.java | 116 -- .../common/config/keys/KeyRandomArtTest.java | 117 -- .../common/config/keys/KeyUtilsCloneTest.java | 120 -- .../KeyUtilsFingerprintCaseSensitivityTest.java | 96 -- .../keys/KeyUtilsFingerprintGenerationTest.java | 159 --- .../sshd/common/config/keys/KeyUtilsTest.java | 157 --- .../common/config/keys/PublicKeyEntryTest.java | 62 - .../loader/AESPrivateKeyObfuscatorTest.java | 79 -- .../OpenSSHKeyPairResourceParserTest.java | 108 -- .../pem/PKCS8PEMResourceKeyPairParserTest.java | 107 -- .../sshd/common/digest/BuiltinDigestsTest.java | 65 - .../file/root/RootedFileSystemProviderTest.java | 4 +- .../common/forward/PortForwardingLoadTest.java | 6 +- .../sshd/common/forward/PortForwardingTest.java | 14 +- .../common/future/DefaultSshFutureTest.java | 137 -- .../common/keyprovider/KeyPairProviderTest.java | 79 -- .../apache/sshd/common/mac/BuiltinMacsTest.java | 166 --- .../org/apache/sshd/common/mac/MacTest.java | 7 +- .../apache/sshd/common/mac/MacVectorsTest.java | 311 ----- .../sshd/common/random/RandomFactoryTest.java | 83 -- .../session/helpers/AbstractSessionTest.java | 2 +- .../common/signature/BuiltinSignaturesTest.java | 149 --- .../sshd/common/signature/SignatureDSATest.java | 109 -- .../signature/SignatureFactoriesTest.java | 6 +- .../sshd/common/signature/SignatureRSATest.java | 119 -- .../common/signature/SignaturesDevelopment.java | 79 -- .../common/util/EventListenerUtilsTest.java | 149 --- .../sshd/common/util/GenericUtilsTest.java | 173 --- .../sshd/common/util/Int2IntFunctionTest.java | 154 --- .../sshd/common/util/NumberUtilsTest.java | 77 -- .../apache/sshd/common/util/OsUtilsTest.java | 135 -- .../sshd/common/util/SecurityUtilsTest.java | 232 ---- .../sshd/common/util/SelectorUtilsTest.java | 147 --- .../sshd/common/util/ThreadUtilsTest.java | 72 -- .../sshd/common/util/ValidateUtilsTest.java | 44 - .../sshd/common/util/VersionInfoTest.java | 52 - .../sshd/common/util/buffer/BufferTest.java | 103 -- .../common/util/buffer/BufferUtilsTest.java | 73 -- .../util/closeable/CloseableUtilsTest.java | 163 --- .../common/util/io/EmptyInputStreamTest.java | 120 -- .../apache/sshd/common/util/io/IoUtilsTest.java | 61 - .../common/util/io/LimitInputStreamTest.java | 118 -- .../util/io/ModifiableFileWatcherTest.java | 82 -- .../common/util/io/NoCloseInputStreamTest.java | 89 -- .../common/util/io/NoCloseOutputStreamTest.java | 69 -- .../sshd/common/util/io/NoCloseReaderTest.java | 95 -- .../sshd/common/util/io/NoCloseWriterTest.java | 73 -- .../common/util/io/NullInputStreamTest.java | 118 -- .../common/util/io/NullOutputStreamTest.java | 80 -- .../sshd/common/util/io/der/ASN1ClassTest.java | 67 - .../sshd/common/util/io/der/ASN1TypeTest.java | 67 - .../sshd/common/util/io/der/DERParserTest.java | 61 - .../sshd/common/util/io/der/DERWriterTest.java | 64 - .../util/net/SshdSocketIpv6AddressTest.java | 88 -- ...SecurityProviderRegistrarCipherNameTest.java | 75 -- .../SecurityProviderRegistrarTestSupport.java | 62 - .../util/security/eddsa/EDDSAProviderTest.java | 126 -- .../util/security/eddsa/Ed25519VectorsTest.java | 238 ---- .../EdDSASecurityProviderRegistrarTest.java | 85 -- .../sshd/server/ServerSessionListenerTest.java | 6 +- .../server/auth/WelcomeBannerPhaseTest.java | 6 +- .../sshd/server/auth/WelcomeBannerTest.java | 6 +- .../AbstractGeneratorHostKeyProviderTest.java | 83 -- .../PEMGeneratorHostKeyProviderTest.java | 141 --- .../SimpleGeneratorHostKeyProviderTest.java | 133 -- .../apache/sshd/util/test/BaseTestSupport.java | 543 +------- .../sshd/util/test/CoreTestSupportUtils.java | 63 + .../test/JUnit4ClassRunnerWithParameters.java | 48 - .../JUnit4ClassRunnerWithParametersFactory.java | 58 - .../test/JUnit4SingleInstanceClassRunner.java | 54 - .../org/apache/sshd/util/test/NoIoTestCase.java | 30 - .../test/OutputCountTrackingOutputStream.java | 56 - .../apache/sshd/util/test/TeeOutputStream.java | 64 - .../java/org/apache/sshd/util/test/Utils.java | 652 ---------- .../testReadGlobalHostsConfigEntries.config.txt | 22 - .../testReadMultipleHostPatterns.config.txt | 5 - .../testReadSimpleHostsConfigEntries.config.txt | 8 - .../org/apache/sshd/client/config/keys/id_dsa | 12 - .../org/apache/sshd/client/config/keys/id_ecdsa | 5 - .../apache/sshd/client/config/keys/id_rsa_key | 27 - ...OpenSSHKeyPairResourceParserTest-DSA-KeyPair | 21 - ...SSHKeyPairResourceParserTest-DSA-KeyPair.pub | 1 - ...enSSHKeyPairResourceParserTest-ECDSA-KeyPair | 12 - ...HKeyPairResourceParserTest-ECDSA-KeyPair.pub | 1 - ...SSHKeyPairResourceParserTest-ED25519-KeyPair | 7 - ...eyPairResourceParserTest-ED25519-KeyPair.pub | 1 - ...OpenSSHKeyPairResourceParserTest-RSA-KeyPair | 49 - ...SSHKeyPairResourceParserTest-RSA-KeyPair.pub | 1 - .../EDDSAProviderTest-EDDSA-OpenSSH-KeyPair | 7 - .../EDDSAProviderTest-EDDSA-OpenSSH-KeyPair.pub | 1 - .../common/util/SecurityUtilsTest-DSA-KeyPair | 12 - .../util/SecurityUtilsTest-DSA-KeyPair.pub | 1 - .../util/SecurityUtilsTest-EC-256-KeyPair | 5 - .../util/SecurityUtilsTest-EC-256-KeyPair.pub | 1 - .../util/SecurityUtilsTest-EC-384-KeyPair | 6 - .../util/SecurityUtilsTest-EC-384-KeyPair.pub | 1 - .../util/SecurityUtilsTest-EC-521-KeyPair | 7 - .../util/SecurityUtilsTest-EC-521-KeyPair.pub | 1 - .../common/util/SecurityUtilsTest-RSA-KeyPair | 27 - .../util/SecurityUtilsTest-RSA-KeyPair.pub | 1 - .../super-secret-passphrase-RSA-AES-128-key | 30 - .../super-secret-passphrase-RSA-AES-128-key.pub | 1 - .../super-secret-passphrase-RSA-AES-192-key | 30 - .../super-secret-passphrase-RSA-AES-192-key.pub | 1 - .../super-secret-passphrase-RSA-AES-256-key | 30 - .../super-secret-passphrase-RSA-AES-256-key.pub | 1 - .../super-secret-passphrase-RSA-DES-EDE3-key | 30 - ...super-secret-passphrase-RSA-DES-EDE3-key.pub | 1 - sshd-git/pom.xml | 7 + .../sshd/git/pack/GitPackCommandTest.java | 6 +- .../apache/sshd/git/pgm/GitPgmCommandTest.java | 4 +- sshd-ldap/pom.xml | 7 + .../sshd/server/auth/BaseAuthenticatorTest.java | 17 +- sshd-mina/pom.xml | 7 + sshd-netty/pom.xml | 7 + sshd-scp/pom.xml | 9 +- .../org/apache/sshd/client/scp/ScpTest.java | 154 +-- .../sshd/client/scp/SimpleScpClientTest.java | 20 +- sshd-sftp/pom.xml | 9 +- .../subsystem/sftp/SftpFileSystemProvider.java | 8 +- .../sftp/AbstractSftpClientTestSupport.java | 6 +- .../sftp/DefaultCloseableHandleTest.java | 4 +- .../subsystem/sftp/SftpFileSystemTest.java | 30 +- .../sshd/client/subsystem/sftp/SftpTest.java | 78 +- .../subsystem/sftp/SftpVersionSelectorTest.java | 4 +- .../client/subsystem/sftp/SftpVersionsTest.java | 24 +- .../subsystem/sftp/SimpleSftpClientTest.java | 8 +- .../helpers/AbstractCheckFileExtensionTest.java | 8 +- .../helpers/AbstractMD5HashExtensionTest.java | 8 +- .../helpers/CopyDataExtensionImplTest.java | 8 +- .../helpers/CopyFileExtensionImplTest.java | 11 +- .../SpaceAvailableExtensionImplTest.java | 6 +- .../openssh/helpers/OpenSSHExtensionsTest.java | 10 +- .../subsystem/sftp/SftpConstantsTest.java | 4 +- .../sftp/SftpUniversalOwnerAndGroupTest.java | 4 +- .../sftp/SftpSubsystemFactoryTest.java | 4 +- sshd-spring-sftp/pom.xml | 7 + .../sftp/ApacheSshdSftpSessionFactory.java | 4 +- .../sftp/ApacheSshdSftpSessionFactoryTest.java | 21 +- 793 files changed, 44627 insertions(+), 44210 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/assembly/pom.xml ---------------------------------------------------------------------- diff --git a/assembly/pom.xml b/assembly/pom.xml index 6efb67a..93011a8 100644 --- a/assembly/pom.xml +++ b/assembly/pom.xml @@ -38,6 +38,11 @@ <dependencies> <dependency> <groupId>org.apache.sshd</groupId> + <artifactId>sshd-common</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.sshd</groupId> <artifactId>sshd-core</artifactId> <version>${project.version}</version> </dependency> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 34d245f..a684d78 100644 --- a/pom.xml +++ b/pom.xml @@ -1135,6 +1135,7 @@ </reporting> <modules> + <module>sshd-common</module> <module>sshd-core</module> <module>sshd-mina</module> <module>sshd-netty</module> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-cli/pom.xml ---------------------------------------------------------------------- diff --git a/sshd-cli/pom.xml b/sshd-cli/pom.xml index 3fdfb7a..3babf6b 100644 --- a/sshd-cli/pom.xml +++ b/sshd-cli/pom.xml @@ -61,6 +61,13 @@ <type>test-jar</type> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.sshd</groupId> + <artifactId>sshd-common</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> <!-- For the I/O factories --> <dependency> <groupId>org.apache.sshd</groupId> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-cli/src/main/java/org/apache/sshd/cli/CliSupport.java ---------------------------------------------------------------------- diff --git a/sshd-cli/src/main/java/org/apache/sshd/cli/CliSupport.java b/sshd-cli/src/main/java/org/apache/sshd/cli/CliSupport.java index 27c6d96..025c209 100644 --- a/sshd-cli/src/main/java/org/apache/sshd/cli/CliSupport.java +++ b/sshd-cli/src/main/java/org/apache/sshd/cli/CliSupport.java @@ -24,8 +24,8 @@ import java.net.SocketAddress; import java.util.Map; import java.util.Objects; +import org.apache.sshd.common.config.ConfigFileReaderSupport; import org.apache.sshd.common.config.LogLevelValue; -import org.apache.sshd.common.config.SshConfigFileReader; import org.apache.sshd.common.helpers.AbstractFactoryManager; import org.apache.sshd.common.io.BuiltinIoServiceFactoryFactories; import org.apache.sshd.common.io.IoAcceptor; @@ -105,14 +105,14 @@ public abstract class CliSupport { manager.setIoServiceFactoryFactory(factory.create()); - String levelValue = (options == null) ? null : Objects.toString(options.get(SshConfigFileReader.LOG_LEVEL_CONFIG_PROP), null); + String levelValue = (options == null) ? null : Objects.toString(options.get(ConfigFileReaderSupport.LOG_LEVEL_CONFIG_PROP), null); if (GenericUtils.isEmpty(levelValue)) { return manager; } LogLevelValue level = LogLevelValue.fromName(levelValue); if (level == null) { - throw new IllegalArgumentException("Unknown " + SshConfigFileReader.LOG_LEVEL_CONFIG_PROP + " option value: " + levelValue); + throw new IllegalArgumentException("Unknown " + ConfigFileReaderSupport.LOG_LEVEL_CONFIG_PROP + " option value: " + levelValue); } if ((level != LogLevelValue.FATAL) && (level != LogLevelValue.ERROR) && (level != LogLevelValue.INFO)) { http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshClientCliSupport.java ---------------------------------------------------------------------- diff --git a/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshClientCliSupport.java b/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshClientCliSupport.java index 0d7d2f5..2d129f6 100644 --- a/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshClientCliSupport.java +++ b/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshClientCliSupport.java @@ -65,7 +65,7 @@ import org.apache.sshd.common.cipher.Cipher; import org.apache.sshd.common.compression.BuiltinCompressions; import org.apache.sshd.common.compression.Compression; import org.apache.sshd.common.config.CompressionConfigValue; -import org.apache.sshd.common.config.SshConfigFileReader; +import org.apache.sshd.common.config.ConfigFileReaderSupport; import org.apache.sshd.common.config.keys.BuiltinIdentities; import org.apache.sshd.common.config.keys.KeyUtils; import org.apache.sshd.common.config.keys.PublicKeyEntry; @@ -236,7 +236,7 @@ public abstract class SshClientCliSupport extends CliSupport { } if (port <= 0) { - port = SshConfigFileReader.DEFAULT_PORT; + port = ConfigFileReaderSupport.DEFAULT_PORT; } // TODO use a configurable wait time @@ -424,7 +424,7 @@ public abstract class SshClientCliSupport extends CliSupport { } String strictValue = Objects.toString(options.remove(KnownHostsServerKeyVerifier.STRICT_CHECKING_OPTION), "true"); - if (!SshConfigFileReader.parseBooleanValue(strictValue)) { + if (!ConfigFileReaderSupport.parseBooleanValue(strictValue)) { return current; } @@ -506,7 +506,7 @@ public abstract class SshClientCliSupport extends CliSupport { } public static List<NamedFactory<Compression>> setupCompressions(PropertyResolver options, PrintStream stderr) { - String argVal = PropertyResolverUtils.getString(options, SshConfigFileReader.COMPRESSION_PROP); + String argVal = PropertyResolverUtils.getString(options, ConfigFileReaderSupport.COMPRESSION_PROP); if (GenericUtils.isEmpty(argVal)) { return Collections.emptyList(); } @@ -543,10 +543,10 @@ public abstract class SshClientCliSupport extends CliSupport { } public static List<NamedFactory<Mac>> setupMacs(PropertyResolver options, PrintStream stderr) { - String argVal = PropertyResolverUtils.getString(options, SshConfigFileReader.MACS_CONFIG_PROP); + String argVal = PropertyResolverUtils.getString(options, ConfigFileReaderSupport.MACS_CONFIG_PROP); return GenericUtils.isEmpty(argVal) ? Collections.emptyList() - : setupMacs(SshConfigFileReader.MACS_CONFIG_PROP, argVal, null, stderr); + : setupMacs(ConfigFileReaderSupport.MACS_CONFIG_PROP, argVal, null, stderr); } public static List<NamedFactory<Mac>> setupMacs(String argName, String argVal, List<NamedFactory<Mac>> current, PrintStream stderr) { @@ -571,10 +571,10 @@ public abstract class SshClientCliSupport extends CliSupport { } public static List<NamedFactory<Cipher>> setupCiphers(PropertyResolver options, PrintStream stderr) { - String argVal = PropertyResolverUtils.getString(options, SshConfigFileReader.CIPHERS_CONFIG_PROP); + String argVal = PropertyResolverUtils.getString(options, ConfigFileReaderSupport.CIPHERS_CONFIG_PROP); return GenericUtils.isEmpty(argVal) ? Collections.emptyList() - : setupCiphers(SshConfigFileReader.CIPHERS_CONFIG_PROP, argVal, null, stderr); + : setupCiphers(ConfigFileReaderSupport.CIPHERS_CONFIG_PROP, argVal, null, stderr); } // returns null - e.g., re-specified or no supported cipher found http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshKeyScanMain.java ---------------------------------------------------------------------- diff --git a/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshKeyScanMain.java b/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshKeyScanMain.java index b5350f0..adc120f 100644 --- a/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshKeyScanMain.java +++ b/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshKeyScanMain.java @@ -63,7 +63,7 @@ import org.apache.sshd.client.keyverifier.ServerKeyVerifier; import org.apache.sshd.client.session.ClientSession; import org.apache.sshd.common.NamedFactory; import org.apache.sshd.common.cipher.ECCurves; -import org.apache.sshd.common.config.SshConfigFileReader; +import org.apache.sshd.common.config.ConfigFileReaderSupport; import org.apache.sshd.common.config.keys.BuiltinIdentities; import org.apache.sshd.common.config.keys.KeyUtils; import org.apache.sshd.common.config.keys.PublicKeyEntry; @@ -711,7 +711,7 @@ public class SshKeyScanMain implements Channel, Callable<Void>, ServerKeyVerifie public static <S extends SshKeyScanMain> S initializeScanner(S scanner, Collection<String> hosts) throws IOException { setInputStream(scanner, hosts); if (scanner.getPort() <= 0) { - scanner.setPort(SshConfigFileReader.DEFAULT_PORT); + scanner.setPort(ConfigFileReaderSupport.DEFAULT_PORT); } if (scanner.getTimeout() <= 0L) { http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-cli/src/main/java/org/apache/sshd/cli/server/SshServerCliSupport.java ---------------------------------------------------------------------- diff --git a/sshd-cli/src/main/java/org/apache/sshd/cli/server/SshServerCliSupport.java b/sshd-cli/src/main/java/org/apache/sshd/cli/server/SshServerCliSupport.java index 8b392bc..6cdffc8 100644 --- a/sshd-cli/src/main/java/org/apache/sshd/cli/server/SshServerCliSupport.java +++ b/sshd-cli/src/main/java/org/apache/sshd/cli/server/SshServerCliSupport.java @@ -40,7 +40,7 @@ import org.apache.sshd.cli.CliSupport; import org.apache.sshd.common.NamedFactory; import org.apache.sshd.common.PropertyResolver; import org.apache.sshd.common.PropertyResolverUtils; -import org.apache.sshd.common.config.SshConfigFileReader; +import org.apache.sshd.common.config.ConfigFileReaderSupport; import org.apache.sshd.common.config.keys.BuiltinIdentities; import org.apache.sshd.common.config.keys.KeyUtils; import org.apache.sshd.common.keyprovider.KeyPairProvider; @@ -166,7 +166,7 @@ public abstract class SshServerCliSupport extends CliSupport { return subsystems; } - String nameList = (options == null) ? null : options.getString(SshConfigFileReader.SUBSYSTEM_CONFIG_PROP); + String nameList = (options == null) ? null : options.getString(ConfigFileReaderSupport.SUBSYSTEM_CONFIG_PROP); if ("none".equalsIgnoreCase(nameList)) { return Collections.emptyList(); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-cli/src/main/java/org/apache/sshd/cli/server/SshServerMain.java ---------------------------------------------------------------------- diff --git a/sshd-cli/src/main/java/org/apache/sshd/cli/server/SshServerMain.java b/sshd-cli/src/main/java/org/apache/sshd/cli/server/SshServerMain.java index 0740d65..92bd182 100644 --- a/sshd-cli/src/main/java/org/apache/sshd/cli/server/SshServerMain.java +++ b/sshd-cli/src/main/java/org/apache/sshd/cli/server/SshServerMain.java @@ -30,6 +30,7 @@ import org.apache.sshd.common.NamedFactory; import org.apache.sshd.common.NamedResource; import org.apache.sshd.common.PropertyResolver; import org.apache.sshd.common.PropertyResolverUtils; +import org.apache.sshd.common.config.ConfigFileReaderSupport; import org.apache.sshd.common.config.SshConfigFileReader; import org.apache.sshd.common.keyprovider.KeyPairProvider; import org.apache.sshd.common.util.GenericUtils; @@ -138,7 +139,7 @@ public class SshServerMain extends SshServerCliSupport { keyFiles = new LinkedList<>(); } keyFiles.add(optValue); - } else if (SshConfigFileReader.PORT_CONFIG_PROP.equals(optName)) { + } else if (ConfigFileReaderSupport.PORT_CONFIG_PROP.equals(optName)) { port = Integer.parseInt(optValue); } else { options.put(optName, optValue); @@ -166,7 +167,7 @@ public class SshServerMain extends SshServerCliSupport { setupServerBanner(sshd, resolver); sshd.setPort(port); - String macsOverride = resolver.getString(SshConfigFileReader.MACS_CONFIG_PROP); + String macsOverride = resolver.getString(ConfigFileReaderSupport.MACS_CONFIG_PROP); if (GenericUtils.isNotEmpty(macsOverride)) { SshConfigFileReader.configureMacs(sshd, macsOverride, true, true); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java ---------------------------------------------------------------------- diff --git a/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java b/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java index 51596b1..37cf8bc 100644 --- a/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java +++ b/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java @@ -35,7 +35,7 @@ import java.util.concurrent.Future; import org.apache.sshd.common.PropertyResolver; import org.apache.sshd.common.PropertyResolverUtils; -import org.apache.sshd.common.config.SshConfigFileReader; +import org.apache.sshd.common.config.ConfigFileReaderSupport; import org.apache.sshd.common.io.BuiltinIoServiceFactoryFactories; import org.apache.sshd.common.io.IoServiceFactory; import org.apache.sshd.common.util.GenericUtils; @@ -56,7 +56,8 @@ import org.apache.sshd.server.scp.ScpCommandFactory; import org.apache.sshd.server.session.ServerSession; import org.apache.sshd.server.shell.ShellFactory; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory; -import org.apache.sshd.util.test.Utils; +import org.apache.sshd.util.test.CommonTestSupportUtils; +import org.apache.sshd.util.test.CoreTestSupportUtils; /** * A basic implementation to allow remote mounting of the local file system via SFTP @@ -249,7 +250,7 @@ public final class SshFsMounter extends SshServerCliSupport { ////////////////////////////////////////////////////////////////////////// public static void main(String[] args) throws Exception { - int port = SshConfigFileReader.DEFAULT_PORT; + int port = ConfigFileReaderSupport.DEFAULT_PORT; boolean error = false; Map<String, Object> options = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); int numArgs = GenericUtils.length(args); @@ -296,7 +297,7 @@ public final class SshFsMounter extends SshServerCliSupport { } SshServer sshd = error ? null : setupIoServiceFactory( - Utils.setupTestServer(SshFsMounter.class), options, System.out, System.err, args); + CoreTestSupportUtils.setupTestServer(SshFsMounter.class), options, System.out, System.err, args); if (sshd == null) { error = true; } @@ -309,7 +310,7 @@ public final class SshFsMounter extends SshServerCliSupport { Map<String, Object> props = sshd.getProperties(); props.putAll(options); PropertyResolver resolver = PropertyResolverUtils.toPropertyResolver(options); - File targetFolder = Objects.requireNonNull(Utils.detectTargetFolder(MounterCommandFactory.class), "Failed to detect target folder"); + File targetFolder = Objects.requireNonNull(CommonTestSupportUtils.detectTargetFolder(MounterCommandFactory.class), "Failed to detect target folder"); if (SecurityUtils.isBouncyCastleRegistered()) { sshd.setKeyPairProvider(SecurityUtils.createGeneratorHostKeyProvider(new File(targetFolder, "key.pem").toPath())); } else { http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-common/pom.xml ---------------------------------------------------------------------- diff --git a/sshd-common/pom.xml b/sshd-common/pom.xml new file mode 100644 index 0000000..f893b19 --- /dev/null +++ b/sshd-common/pom.xml @@ -0,0 +1,128 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + + <!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.sshd</groupId> + <artifactId>sshd</artifactId> + <version>2.0.1-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + + <artifactId>sshd-common</artifactId> + <name>Apache Mina SSHD :: Common support utilities</name> + <packaging>jar</packaging> + <inceptionYear>2018</inceptionYear> + + <properties> + <projectRoot>${project.basedir}/..</projectRoot> + </properties> + + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + + <dependency> + <groupId>org.bouncycastle</groupId> + <artifactId>bcpg-jdk15on</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.bouncycastle</groupId> + <artifactId>bcpkix-jdk15on</artifactId> + <optional>true</optional> + </dependency> + + <!-- For ed25519 support --> + <dependency> + <groupId>net.i2p.crypto</groupId> + <artifactId>eddsa</artifactId> + <optional>true</optional> + </dependency> + + <!-- test dependencies --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.servicemix.bundles</groupId> + <artifactId>org.apache.servicemix.bundles.not-yet-commons-ssl</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <resources> + <resource> + <directory>src/main/filtered-resources</directory> + <filtering>true</filtering> + </resource> + </resources> + <plugins> + <!-- publish the test-jar since it contains some classes used by other + artifacts tests --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>test-jar</goal> + </goals> + <configuration> + <includes> + <include>org/apache/sshd/util/test/**/*</include> + </includes> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <redirectTestOutputToFile>true</redirectTestOutputToFile> + <reportsDirectory>${project.build.directory}/surefire-reports-common</reportsDirectory> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-common/src/main/filtered-resources/org/apache/sshd/sshd-version.properties ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/filtered-resources/org/apache/sshd/sshd-version.properties b/sshd-common/src/main/filtered-resources/org/apache/sshd/sshd-version.properties new file mode 100644 index 0000000..2c32c28 --- /dev/null +++ b/sshd-common/src/main/filtered-resources/org/apache/sshd/sshd-version.properties @@ -0,0 +1,23 @@ +## +## Licensed to the Apache Software Foundation (ASF) under one +## or more contributor license agreements. See the NOTICE file +## distributed with this work for additional information +## regarding copyright ownership. The ASF licenses this file +## to you under the Apache License, Version 2.0 (the +## "License"); you may not use this file except in compliance +## with the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, +## software distributed under the License is distributed on an +## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +## KIND, either express or implied. See the License for the +## specific language governing permissions and limitations +## under the License. +## + +groupId=${pom.groupId} +artifactId=${pom.artifactId} +version=${pom.version} +sshd-version=${pom.artifactId}-${pom.version} http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-common/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java b/sshd-common/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java new file mode 100644 index 0000000..cfd1f85 --- /dev/null +++ b/sshd-common/src/main/java/org/apache/sshd/client/auth/AuthenticationIdentitiesProvider.java @@ -0,0 +1,125 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.sshd.client.auth; + +import java.security.KeyPair; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import org.apache.sshd.client.auth.password.PasswordIdentityProvider; +import org.apache.sshd.common.config.keys.KeyUtils; +import org.apache.sshd.common.keyprovider.KeyIdentityProvider; +import org.apache.sshd.common.util.GenericUtils; + +/** + * @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a> + */ +public interface AuthenticationIdentitiesProvider extends KeyIdentityProvider, PasswordIdentityProvider { + + /** + * Compares 2 password identities - returns zero ONLY if <U>both</U> compared + * objects are {@link String}s and equal to each other + */ + Comparator<Object> PASSWORD_IDENTITY_COMPARATOR = (o1, o2) -> { + if (!(o1 instanceof String) || !(o2 instanceof String)) { + return -1; + } else { + return ((String) o1).compareTo((String) o2); + } + }; + + /** + * Compares 2 {@link KeyPair} identities - returns zero ONLY if <U>both</U> compared + * objects are {@link KeyPair}s and equal to each other + */ + Comparator<Object> KEYPAIR_IDENTITY_COMPARATOR = (o1, o2) -> { + if ((!(o1 instanceof KeyPair)) || (!(o2 instanceof KeyPair))) { + return -1; + } else if (KeyUtils.compareKeyPairs((KeyPair) o1, (KeyPair) o2)) { + return 0; + } else { + return 1; + } + }; + + /** + * @return All the currently available identities - passwords, keys, etc... + */ + Iterable<?> loadIdentities(); + + static int findIdentityIndex(List<?> identities, Comparator<? super Object> comp, Object target) { + for (int index = 0; index < identities.size(); index++) { + Object value = identities.get(index); + if (comp.compare(value, target) == 0) { + return index; + } + } + + return -1; + } + + /** + * @param identities The {@link Iterable} identities - OK if {@code null}/empty + * @return An {@link AuthenticationIdentitiesProvider} wrapping the identities + */ + static AuthenticationIdentitiesProvider wrapIdentities(Iterable<?> identities) { + return new AuthenticationIdentitiesProvider() { + @Override + public Iterable<KeyPair> loadKeys() { + return selectIdentities(KeyPair.class); + } + + @Override + public Iterable<String> loadPasswords() { + return selectIdentities(String.class); + } + + @Override + public Iterable<?> loadIdentities() { + return selectIdentities(Object.class); + } + + // NOTE: returns a NEW Collection on every call so that the original + // identities remain unchanged + private <T> Collection<T> selectIdentities(Class<T> type) { + Collection<T> matches = null; + for (Iterator<?> iter = GenericUtils.iteratorOf(identities); iter.hasNext();) { + Object o = iter.next(); + Class<?> t = o.getClass(); + if (!type.isAssignableFrom(t)) { + continue; + } + + if (matches == null) { + matches = new LinkedList<>(); + } + + matches.add(type.cast(o)); + } + + return (matches == null) ? Collections.<T>emptyList() : matches; + } + }; + } +} http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-common/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java b/sshd-common/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java new file mode 100644 index 0000000..81c26ca --- /dev/null +++ b/sshd-common/src/main/java/org/apache/sshd/client/auth/hostbased/HostKeyIdentityProvider.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.sshd.client.auth.hostbased; + +import java.security.KeyPair; +import java.security.cert.X509Certificate; +import java.util.AbstractMap.SimpleImmutableEntry; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.sshd.common.util.GenericUtils; + +/** + * @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a> + */ +@FunctionalInterface +public interface HostKeyIdentityProvider { + /** + * @return The host keys as a {@link java.util.Map.Entry} of key + certificates (which can be {@code null}/empty) + */ + Iterable<? extends Map.Entry<KeyPair, List<X509Certificate>>> loadHostKeys(); + + static Iterator<? extends Map.Entry<KeyPair, List<X509Certificate>>> iteratorOf(HostKeyIdentityProvider provider) { + return GenericUtils.iteratorOf((provider == null) ? null : provider.loadHostKeys()); + } + + static HostKeyIdentityProvider wrap(KeyPair... pairs) { + return wrap(GenericUtils.asList(pairs)); + } + + static HostKeyIdentityProvider wrap(Iterable<? extends KeyPair> pairs) { + return () -> GenericUtils.wrapIterable(pairs, kp -> new SimpleImmutableEntry<>(kp, Collections.<X509Certificate>emptyList())); + } +} http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-common/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java b/sshd-common/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java new file mode 100644 index 0000000..f075bf8 --- /dev/null +++ b/sshd-common/src/main/java/org/apache/sshd/client/auth/password/PasswordIdentityProvider.java @@ -0,0 +1,169 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.sshd.client.auth.password; + +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.function.Function; +import java.util.function.Supplier; + +import org.apache.sshd.common.util.GenericUtils; + +/** + * @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a> + */ +@FunctionalInterface +public interface PasswordIdentityProvider { + + /** + * An "empty" implementation of {@link PasswordIdentityProvider} that returns + * and empty group of passwords + */ + PasswordIdentityProvider EMPTY_PASSWORDS_PROVIDER = new PasswordIdentityProvider() { + @Override + public Iterable<String> loadPasswords() { + return Collections.emptyList(); + } + + @Override + public String toString() { + return "EMPTY"; + } + }; + + /** + * Invokes {@link PasswordIdentityProvider#loadPasswords()} and returns the result. + * Ignores {@code null} providers (i.e., returns an empty iterable instance) + */ + Function<PasswordIdentityProvider, Iterable<String>> LOADER = p -> + (p == null) ? Collections.emptyList() : p.loadPasswords(); + + /** + * @return The currently available passwords - ignored if {@code null} + */ + Iterable<String> loadPasswords(); + + /** + * Creates a "unified" {@link Iterator} of passwords out of 2 possible + * {@link PasswordIdentityProvider} + * + * @param identities The registered passwords + * @param passwords Extra available passwords + * @return The wrapping iterator + * @see #resolvePasswordIdentityProvider(PasswordIdentityProvider, PasswordIdentityProvider) + */ + static Iterator<String> iteratorOf(PasswordIdentityProvider identities, PasswordIdentityProvider passwords) { + return iteratorOf(resolvePasswordIdentityProvider(identities, passwords)); + } + + /** + * Resolves a non-{@code null} iterator of the available passwords + * + * @param provider The {@link PasswordIdentityProvider} - ignored if {@code null} (i.e., + * return an empty iterator) + * @return A non-{@code null} iterator - which may be empty if no provider or no passwords + */ + static Iterator<String> iteratorOf(PasswordIdentityProvider provider) { + return GenericUtils.iteratorOf((provider == null) ? null : provider.loadPasswords()); + } + + /** + * <P>Creates a "unified" {@link PasswordIdentityProvider} out of 2 possible ones + * as follows:</P></BR> + * <UL> + * <LI>If both are {@code null} then return {@code null}.</LI> + * <LI>If either one is {@code null} then use the non-{@code null} one.</LI> + * <LI>If both are the same instance then use it.</U> + * <LI>Otherwise, returns a wrapper that groups both providers.</LI> + * </UL> + * @param identities The registered passwords + * @param passwords The extra available passwords + * @return The resolved provider + * @see #multiProvider(PasswordIdentityProvider...) + */ + static PasswordIdentityProvider resolvePasswordIdentityProvider( + PasswordIdentityProvider identities, PasswordIdentityProvider passwords) { + if ((passwords == null) || (identities == passwords)) { + return identities; + } else if (identities == null) { + return passwords; + } else { + return multiProvider(identities, passwords); + } + } + + /** + * Wraps a group of {@link PasswordIdentityProvider} into a single one + * + * @param providers The providers - ignored if {@code null}/empty (i.e., returns + * {@link #EMPTY_PASSWORDS_PROVIDER} + * @return The wrapping provider + * @see #multiProvider(Collection) + */ + static PasswordIdentityProvider multiProvider(PasswordIdentityProvider... providers) { + return multiProvider(GenericUtils.asList(providers)); + } + + /** + * Wraps a group of {@link PasswordIdentityProvider} into a single one + * + * @param providers The providers - ignored if {@code null}/empty (i.e., returns + * {@link #EMPTY_PASSWORDS_PROVIDER} + * @return The wrapping provider + */ + static PasswordIdentityProvider multiProvider(Collection<? extends PasswordIdentityProvider> providers) { + return GenericUtils.isEmpty(providers) ? EMPTY_PASSWORDS_PROVIDER : wrapPasswords(iterableOf(providers)); + } + + /** + * Wraps a group of {@link PasswordIdentityProvider} into an {@link Iterable} of their combined passwords + * + * @param providers The providers - ignored if {@code null}/empty (i.e., returns an empty iterable instance) + * @return The wrapping iterable + */ + static Iterable<String> iterableOf(Collection<? extends PasswordIdentityProvider> providers) { + Iterable<Supplier<Iterable<String>>> passwordSuppliers = + GenericUtils.<PasswordIdentityProvider, Supplier<Iterable<String>>>wrapIterable(providers, p -> p::loadPasswords); + return GenericUtils.multiIterableSuppliers(passwordSuppliers); + } + + /** + * Wraps a group of passwords into a {@link PasswordIdentityProvider} + * + * @param passwords The passwords - ignored if {@code null}/empty + * (i.e., returns {@link #EMPTY_PASSWORDS_PROVIDER}) + * @return The provider wrapper + */ + static PasswordIdentityProvider wrapPasswords(String... passwords) { + return wrapPasswords(GenericUtils.asList(passwords)); + } + + /** + * Wraps a group of passwords into a {@link PasswordIdentityProvider} + * + * @param passwords The passwords {@link Iterable} - ignored if {@code null} + * (i.e., returns {@link #EMPTY_PASSWORDS_PROVIDER}) + * @return The provider wrapper + */ + static PasswordIdentityProvider wrapPasswords(Iterable<String> passwords) { + return (passwords == null) ? EMPTY_PASSWORDS_PROVIDER : () -> passwords; + } +} http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/10de190e/sshd-common/src/main/java/org/apache/sshd/client/auth/pubkey/PublicKeyIdentity.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/client/auth/pubkey/PublicKeyIdentity.java b/sshd-common/src/main/java/org/apache/sshd/client/auth/pubkey/PublicKeyIdentity.java new file mode 100644 index 0000000..51444ae --- /dev/null +++ b/sshd-common/src/main/java/org/apache/sshd/client/auth/pubkey/PublicKeyIdentity.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sshd.client.auth.pubkey; + +import java.security.PublicKey; + +/** + * Represents a public key identity + * + * @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a> + */ +public interface PublicKeyIdentity { + /** + * @return The {@link PublicKey} identity value + */ + PublicKey getPublicKey(); + + /** + * Proves the public key identity by signing the given data + * + * @param data Data to sign + * @return Signed data - using the identity + * @throws Exception If failed to sign the data + */ + byte[] sign(byte[] data) throws Exception; +} \ No newline at end of file
