以下のコードを使用してSFTPサーバーとの接続を確立しようとしていますが、JavaのJschを使用してsftpサーバーに接続しようとするとアルゴリズムのネゴシエーションが失敗する
情報 - 以下のバージョンを使用しています
- Javaバージョン "1.8.0_101"
- のJava(TM)SEランタイム環境(ビルド1.8.0_101-B13)
- JSC H - 0.1.54
- JUnitの - 期待
JSch jsch = new JSch(); Properties configuration = new Properties(); configuration.put("cipher.s2c", "aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc"); configuration.put("cipher.c2s", "aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc"); configuration.put("kex", "diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256"); Session session = jsch.getSession(user , host, port); session.setPassword(pwd); session.setConfig(configuration); System.out.println("------------------>Establishing Connection..."); session.connect(); System.out.println("------------------>Connection established."); System.out.println("------------------>Creating SFTP Channel."); ChannelSftp sftpChannel = (ChannelSftp) session.openChannel("sftp"); sftpChannel.connect(); System.out.println("------------------>SFTP Channel created.");
- - 4.12
以下のコードを使用してい接続サーバ
-
に正常になされるべきです
- 注 -私はすべての設定を含めてみましたイオンの方法はここでは他のさまざまな記事に記載されていたが、何も働かなかった。
実 -
com.jcraft.jsch.JSchException: Algorithm negotiation fail
at com.jcraft.jsch.Session.receive_kexinit(Session.java:590)
at com.jcraft.jsch.Session.connect(Session.java:320)
at com.jcraft.jsch.Session.connect(Session.java:183)
at FunctionLib.StoreAllRecordsFromLOCAL_IntoRequestList_Test(FunctionLib.java:38)
at TestJunit.testConnectivity(TestJunit.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
ログファイル - 以下のエラー行き方:無線LANを使用して実行すると
INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
INFO: aes256-ctr is not available.
INFO: aes192-ctr is not available.
INFO: aes256-cbc is not available.
INFO: aes192-cbc is not available.
INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: SSH_MSG_KEXINIT sent
INFO: SSH_MSG_KEXINIT received
INFO: kex: server: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,[email protected],diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256
INFO: kex: server: ssh-rsa,[email protected]
INFO: kex: server: aes256-cbc,[email protected],[email protected]
INFO: kex: server: aes256-cbc,[email protected],[email protected]
INFO: kex: server: hmac-sha1,hmac-md5,[email protected]
INFO: kex: server: hmac-sha1,hmac-md5,[email protected]
INFO: kex: server: none,zlib
INFO: kex: server: none,zlib
INFO: kex: server:
INFO: kex: server:
INFO: kex: client: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256
INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: none
INFO: kex: client: none
INFO: kex: client:
INFO: kex: client:
INFO: Disconnecting from 10.92.155.57 port 22
ログ - (接続が正常に確立された) -
Dec 12, 2017 6:14:35 PM FunctionLib$MyJSchLogger log
INFO: Connecting to 10.92.155.6 port 22
Dec 12, 2017 6:14:35 PM FunctionLib$MyJSchLogger log
INFO: Connection established
Dec 12, 2017 6:14:35 PM FunctionLib$MyJSchLogger log
INFO: Remote version string: SSH-2.0-6.4.10.264 SSH Tectia Server
Dec 12, 2017 6:14:35 PM FunctionLib$MyJSchLogger log
INFO: Local version string: SSH-2.0-JSCH-0.1.54
Dec 12, 2017 6:14:35 PM FunctionLib$MyJSchLogger log
INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
Dec 12, 2017 6:14:36 PM FunctionLib$MyJSchLogger log
INFO: aes256-ctr is not available.
Dec 12, 2017 6:14:36 PM FunctionLib$MyJSchLogger log
INFO: aes192-ctr is not available.
Dec 12, 2017 6:14:36 PM FunctionLib$MyJSchLogger log
INFO: aes256-cbc is not available.
Dec 12, 2017 6:14:36 PM FunctionLib$MyJSchLogger log
INFO: aes192-cbc is not available.
Dec 12, 2017 6:14:36 PM FunctionLib$MyJSchLogger log
INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: SSH_MSG_KEXINIT sent
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: SSH_MSG_KEXINIT received
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: server: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,[email protected],diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: server: ssh-rsa,[email protected]
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: server: [email protected],aes128-cbc,aes128-ctr,aes192-cbc,aes192-ctr,aes256-cbc,aes256-ctr,3des-cbc
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: server: [email protected],aes128-cbc,aes128-ctr,aes192-cbc,aes192-ctr,aes256-cbc,aes256-ctr,3des-cbc
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: server: [email protected],hmac-sha1,hmac-sha1-96,hmac-sha2-256,[email protected],[email protected],[email protected],[email protected],hmac-sha2-512,[email protected]
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: server: [email protected],hmac-sha1,hmac-sha1-96,hmac-sha2-256,[email protected],[email protected],[email protected],[email protected],hmac-sha2-512,[email protected]
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: server: none,zlib
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: server: none,zlib
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: server:
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: server:
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: client: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: client: none
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: client: none
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: client:
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: client:
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: server->client aes128-ctr hmac-sha1 none
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: kex: client->server aes128-ctr hmac-sha1 none
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: SSH_MSG_KEXDH_INIT sent
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: expecting SSH_MSG_KEXDH_REPLY
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: ssh_rsa_verify: signature true
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
WARNING: Permanently added '10.92.155.6' (RSA) to the list of known hosts.
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: SSH_MSG_NEWKEYS sent
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: SSH_MSG_NEWKEYS received
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: SSH_MSG_SERVICE_REQUEST sent
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: SSH_MSG_SERVICE_ACCEPT received
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: Authentications that can continue: publickey,keyboard-interactive,password
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: Next authentication method: publickey
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: Authentications that can continue: password
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: Next authentication method: password
Dec 12, 2017 6:14:37 PM FunctionLib$MyJSchLogger log
INFO: Authentication succeeded (password).
ログ(接続が確立されていない) - - LAN使用して実行すると、Sは、上記の問題について
Dec 12, 2017 6:12:36 PM FunctionLib$MyJSchLogger log
INFO: Connecting to 10.92.155.6 port 22
Dec 12, 2017 6:12:36 PM FunctionLib$MyJSchLogger log
INFO: Connection established
Dec 12, 2017 6:12:36 PM FunctionLib$MyJSchLogger log
INFO: Remote version string: SSH-2.0-6.4.10.264 SSH Tectia Server
Dec 12, 2017 6:12:36 PM FunctionLib$MyJSchLogger log
INFO: Local version string: SSH-2.0-JSCH-0.1.54
Dec 12, 2017 6:12:36 PM FunctionLib$MyJSchLogger log
INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
Dec 12, 2017 6:12:37 PM FunctionLib$MyJSchLogger log
INFO: aes256-ctr is not available.
Dec 12, 2017 6:12:37 PM FunctionLib$MyJSchLogger log
INFO: aes192-ctr is not available.
Dec 12, 2017 6:12:37 PM FunctionLib$MyJSchLogger log
INFO: aes256-cbc is not available.
Dec 12, 2017 6:12:37 PM FunctionLib$MyJSchLogger log
INFO: aes192-cbc is not available.
Dec 12, 2017 6:12:37 PM FunctionLib$MyJSchLogger log
INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: SSH_MSG_KEXINIT sent
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: SSH_MSG_KEXINIT received
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: server: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,[email protected],diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: server: ssh-rsa,[email protected]
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: server: aes256-cbc,[email protected],[email protected]
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: server: aes256-cbc,[email protected],[email protected]
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: server: hmac-sha1,hmac-md5,[email protected]
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: server: hmac-sha1,hmac-md5,[email protected]
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: server: none,zlib
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: server: none,zlib
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: server:
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: server:
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: client: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: client: none
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: client: none
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: client:
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: kex: client:
Dec 12, 2017 6:12:38 PM FunctionLib$MyJSchLogger log
INFO: Disconnecting from 10.92.155.6 port 22
こんにちはMartin、 既に私はJSchバージョン0.1.54を使用していますが、最新のバージョンがありますか? – Johnny
Martin、 リクエストしているログを取得する方法を教えてもらえますか? – Johnny
私のコードのどこにこのINに適合する必要があるのかを詳しく教えてください。私は日食自体から複数のエラーに直面しているので。コードを別の(.java)ファイルに貼り付けてコピーする必要がありますか? – Johnny