This is an automated email from the ASF dual-hosted git repository. twolf pushed a commit to branch dev_3.0 in repository https://gitbox.apache.org/repos/asf/mina-sshd.git
commit 07a377c47610511a14a7d2dc5ed52ec3a30b9916 Merge: 5d5a65a26 3ccf910d9 Author: Thomas Wolf <[email protected]> AuthorDate: Sun Jul 20 15:19:03 2025 +0200 Merge branch 'master' into 3.0.0 pom.xml | 10 +- .../keys/impl/SkED25519PublicKeyEntryDecoder.java | 20 ++-- .../common/config/keys/u2f/SkED25519PublicKey.java | 17 ++- .../keys/SkED25519BufferPublicKeyParser.java | 3 +- .../security/eddsa/EdDSASecurityProviderUtils.java | 8 -- .../security/eddsa/NetI2pCryptoEdDSASupport.java | 8 +- .../bouncycastle/BouncyCastleEdDSASupport.java | 4 +- .../util/security/eddsa/generic/EdDSASupport.java | 4 +- .../util/security/eddsa/generic/EdDSAUtils.java | 89 +++++++++++++++ .../signature/KnownHostsCertificateTest.java | 2 +- .../signature/OpenSshHostCertificateTest.java | 2 +- .../server/auth/AuthorizedKeysCertificateTest.java | 2 +- .../apache/sshd/putty/EdDSAPuttyKeyDecoder.java | 13 +-- .../sftp/client/fs/SftpFileSystemProvider.java | 7 +- .../sshd/sftp/client/impl/DefaultSftpClient.java | 16 ++- .../org/apache/sshd/sftp/client/OpenSshTest.java | 123 +++++++++++++++++++++ .../java/org/apache/sshd/sftp/client/SftpTest.java | 40 +++++++ .../client/fs/SftpFileSystemProviderURITest.java | 67 +++++++++++ .../org/apache/sshd/sftp/client/ed25519_key | 7 ++ .../org/apache/sshd/sftp/client/ed25519_key.pub | 1 + .../resources/org/apache/sshd/sftp/client/rsa_key | 27 +++++ .../org/apache/sshd/sftp/client/rsa_key.pub | 1 + 22 files changed, 418 insertions(+), 53 deletions(-) diff --cc pom.xml index c31cff84c,202aadb46..2d4c6ab64 --- a/pom.xml +++ b/pom.xml @@@ -119,8 -118,8 +119,8 @@@ <maven.archiver.version>3.6.3</maven.archiver.version> <plexus.archiver.version>4.10.0</plexus.archiver.version> <!-- See https://pmd.github.io/ for available latest version --> - <pmd.version>7.13.0</pmd.version> + <pmd.version>7.14.0</pmd.version> - + <japicmp.version>0.23.1</japicmp.version> <sshd.tests.timeout.factor>1.0</sshd.tests.timeout.factor> <sshd.tests.rerun.count>2</sshd.tests.rerun.count> diff --cc sshd-common/src/main/java/org/apache/sshd/common/config/keys/impl/SkED25519PublicKeyEntryDecoder.java index d2f882ee3,1380a2b41..d41bcce7c --- a/sshd-common/src/main/java/org/apache/sshd/common/config/keys/impl/SkED25519PublicKeyEntryDecoder.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/config/keys/impl/SkED25519PublicKeyEntryDecoder.java @@@ -63,12 -65,21 +65,12 @@@ public class SkED25519PublicKeyEntryDec } boolean noTouchRequired = parseBooleanHeader(headers, NO_TOUCH_REQUIRED_HEADER, false); - EdDSAPublicKey edDSAPublicKey - = Ed25519PublicKeyDecoder.INSTANCE.decodePublicKey(session, KeyPairProvider.SSH_ED25519, keyData, headers); + PublicKey pk = SecurityUtils.getEDDSAPublicKeyEntryDecoder().decodePublicKey(session, KeyPairProvider.SSH_ED25519, + keyData, headers); String appName = KeyEntryResolver.decodeString(keyData, MAX_APP_NAME_LENGTH); - return new SkED25519PublicKey(appName, noTouchRequired, edDSAPublicKey); + return new SkED25519PublicKey(appName, noTouchRequired, pk); } - @Override - public SkED25519PublicKey clonePublicKey(SkED25519PublicKey key) { - if (key == null) { - return null; - } - - return new SkED25519PublicKey(key.getAppName(), key.isNoTouchRequired(), key.getDelegatePublicKey()); - } - @Override public String encodePublicKey(OutputStream s, SkED25519PublicKey key) throws IOException { Objects.requireNonNull(key, "No public key provided"); diff --cc sshd-sftp/src/test/java/org/apache/sshd/sftp/client/SftpTest.java index b10b365eb,ae662a0e6..47bd19987 --- a/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/SftpTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/SftpTest.java @@@ -391,8 -397,48 +391,48 @@@ class SftpTest extends AbstractSftpClie } @MethodSource("getParameters") + @ParameterizedTest(name = "FILE_HANDLE_SIZE {0}") // see GH-774 + public void copyByReadWrite(int handleSize) throws Exception { + initSftpTest(handleSize); + Path targetPath = detectTargetFolder(); + Path parentPath = targetPath.getParent(); + Path lclSftp = CommonTestSupportUtils.resolve(targetPath, SftpConstants.SFTP_SUBSYSTEM_NAME, getClass().getSimpleName(), + getCurrentTestName()); + Path testFile = assertHierarchyTargetFolderExists(lclSftp).resolve("file.bin"); + // Size matters; with only 1MB GH-774 is not reproducible. Probably the size needs to be larger than the channel + // window (2MB by default). + byte[] expected = new byte[8 * 1024 * 1024]; + + Factory<? extends Random> factory = sshd.getRandomFactory(); + Random rnd = factory.create(); + rnd.fill(expected); + Files.write(testFile, expected); + + String file = CommonTestSupportUtils.resolveRelativeRemotePath(parentPath, testFile); + try (SftpClient sftp = createSingleSessionClient()) { + try (InputStream in = sftp.read(file); + OutputStream out = sftp.write(file + ".new", SftpClient.OpenMode.Create, SftpClient.OpenMode.Write)) { + IoUtils.copy(in, out); + } + byte[] actual; + try (InputStream in = sftp.read(file + ".new"); + ByteArrayOutputStream buf = new ByteArrayOutputStream(expected.length)) { + byte[] data = new byte[4096]; + for (int n = 0; n >= 0;) { + n = in.read(data, 0, data.length); + if (n > 0) { + buf.write(data, 0, n); + } + } + actual = buf.toByteArray(); + } + assertArrayEquals(expected, actual); + } + } + + @MethodSource("getParameters") @ParameterizedTest(name = "FILE_HANDLE_SIZE {0}") - public void emptyFileDownload(int handleSize) throws Exception { + void emptyFileDownload(int handleSize) throws Exception { initSftpTest(handleSize); Assumptions.assumeTrue(OsUtils.isUNIX() || OsUtils.isOSX(), "Not sure appending to a file opened for reading works on Windows");
