{"action":"opened","issue":{"url":"https://api.github.com/repos/hierynomus/sshj/issues/358","repository_url":"https://api.github.com/repos/hierynomus/sshj","labels_url":"https://api.github.com/repos/hierynomus/sshj/issues/358/labels{/name}","comments_url":"https://api.github.com/repos/hierynomus/sshj/issues/358/comments","events_url":"https://api.github.com/repos/hierynomus/sshj/issues/358/events","html_url":"https://github.com/hierynomus/sshj/issues/358","id":257126216,"number":358,"title":"et.schmizz.sshj.transport.TransportException: [HOST_KEY_NOT_VERIFIABLE] Could not verify `ecdsa-sha2-nistp256` host key with fingerprint ...","user":{"login":"mvysny","id":254091,"avatar_url":"https://avatars3.githubusercontent.com/u/254091?v=4","gravatar_id":"","url":"https://api.github.com/users/mvysny","html_url":"https://github.com/mvysny","followers_url":"https://api.github.com/users/mvysny/followers","following_url":"https://api.github.com/users/mvysny/following{/other_user}","gists_url":"https://api.github.com/users/mvysny/gists{/gist_id}","starred_url":"https://api.github.com/users/mvysny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvysny/subscriptions","organizations_url":"https://api.github.com/users/mvysny/orgs","repos_url":"https://api.github.com/users/mvysny/repos","events_url":"https://api.github.com/users/mvysny/events{/privacy}","received_events_url":"https://api.github.com/users/mvysny/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-12T17:41:01Z","updated_at":"2017-09-12T17:41:01Z","closed_at":null,"author_association":"NONE","body":"I'm using sshj 0.22.0; the following code fails for me:\r\n\r\n```\r\n        val ssh = SSHClient()\r\n        ssh.loadKnownHosts()\r\n        ssh.connect(\"my.server\")\r\n```\r\n\r\nThe log output is:\r\n```\r\n20:34:43.940 [main] INFO net.schmizz.sshj.transport.random.BouncyCastleRandom - Generating random seed from SecureRandom.\r\n20:34:43.943 [main] DEBUG net.schmizz.sshj.transport.random.BouncyCastleRandom - Creating random seed took 0 ms\r\n20:34:44.008 [main] DEBUG net.schmizz.sshj.DefaultConfig - Available cipher factories: [net.schmizz.sshj.transport.cipher.AES128CTR$Factory@402a079c, net.schmizz.sshj.transport.cipher.AES192CTR$Factory@59ec2012, net.schmizz.sshj.transport.cipher.AES256CTR$Factory@4cf777e8, net.schmizz.sshj.transport.cipher.AES128CBC$Factory@2f686d1f, net.schmizz.sshj.transport.cipher.AES192CBC$Factory@3fee9989, net.schmizz.sshj.transport.cipher.AES256CBC$Factory@73ad2d6, net.schmizz.sshj.transport.cipher.TripleDESCBC$Factory@7085bdee, net.schmizz.sshj.transport.cipher.BlowfishCBC$Factory@1ce92674, blowfish-ctr, cast128-cbc, cast128-ctr, idea-cbc, idea-ctr, serpent128-cbc, serpent128-ctr, serpent192-cbc, serpent192-ctr, serpent256-cbc, serpent256-ctr, 3des-ctr, twofish128-cbc, twofish128-ctr, twofish192-cbc, twofish192-ctr, twofish256-cbc, twofish256-ctr, twofish-cbc, arcfour, arcfour128, arcfour256]\r\n20:34:44.042 [main] DEBUG net.schmizz.sshj.common.ECDSAVariationsAdapter - Key algo: ecdsa-sha2-nistp256, Key curve: nistp256, Key Len: 65, 0x04: 4\r\nx: [-72, 47, -123, 101, 10, 62, 23, -24, 76, -119, -21, 126, -28, 89, 101, -67, -28, 19, -90, -62, 90, -55, -99, 43, 48, 54, -37, -13, 113, -97, -52, -65]\r\ny: [117, -6, -34, -15, -94, 107, -121, -47, 80, -96, -107, -115, 114, -85, 43, 95, -122, 30, 46, -81, -20, 44, -62, 124, -38, 78, 118, 109, 114, 68, -115, -52]\r\n20:34:44.193 [main] DEBUG net.schmizz.sshj.common.ECDSAVariationsAdapter - Key algo: ecdsa-sha2-nistp256, Key curve: nistp256, Key Len: 65, 0x04: 4\r\nx: [-55, -55, -14, -29, -8, 28, -111, -54, 106, 110, 100, 111, 46, -65, -11, -127, -31, 5, -64, 91, 101, 104, -56, -84, 21, -83, 27, -33, 119, 17, 26, 48]\r\ny: [-67, -52, -10, -90, 112, 72, 86, 75, -51, 63, -78, -32, 102, -23, -88, -31, -42, -62, -110, 118, -20, 16, -34, -109, -91, -75, 14, -73, 35, -37, -59, -34]\r\n20:34:44.194 [main] DEBUG net.schmizz.sshj.common.ECDSAVariationsAdapter - Key algo: ecdsa-sha2-nistp256, Key curve: nistp256, Key Len: 65, 0x04: 4\r\nx: [-55, -55, -14, -29, -8, 28, -111, -54, 106, 110, 100, 111, 46, -65, -11, -127, -31, 5, -64, 91, 101, 104, -56, -84, 21, -83, 27, -33, 119, 17, 26, 48]\r\ny: [-67, -52, -10, -90, 112, 72, 86, 75, -51, 63, -78, -32, 102, -23, -88, -31, -42, -62, -110, 118, -20, 16, -34, -109, -91, -75, 14, -73, 35, -37, -59, -34]\r\n20:34:44.194 [main] DEBUG net.schmizz.sshj.common.ECDSAVariationsAdapter - Key algo: ecdsa-sha2-nistp256, Key curve: nistp256, Key Len: 65, 0x04: 4\r\nx: [-55, -55, -14, -29, -8, 28, -111, -54, 106, 110, 100, 111, 46, -65, -11, -127, -31, 5, -64, 91, 101, 104, -56, -84, 21, -83, 27, -33, 119, 17, 26, 48]\r\ny: [-67, -52, -10, -90, 112, 72, 86, 75, -51, 63, -78, -32, 102, -23, -88, -31, -42, -62, -110, 118, -20, 16, -34, -109, -91, -75, 14, -73, 35, -37, -59, -34]\r\n20:34:44.195 [main] DEBUG net.schmizz.sshj.common.ECDSAVariationsAdapter - Key algo: ecdsa-sha2-nistp256, Key curve: nistp256, Key Len: 65, 0x04: 4\r\nx: [28, -84, 90, -128, 0, 98, 61, -104, 90, -49, 79, 89, 21, 21, 23, -64, -3, 46, 117, -59, 0, -105, 39, 5, -66, 87, -62, 89, 57, -126, 6, -116]\r\ny: [-65, 108, -82, -12, 38, 101, -34, -37, 109, -86, 55, -123, 6, 104, -120, -102, 32, -74, -26, 3, -3, -98, -53, -91, 121, 110, 126, -33, 23, 26, 111, 17]\r\n20:34:44.196 [main] DEBUG net.schmizz.sshj.common.ECDSAVariationsAdapter - Key algo: ecdsa-sha2-nistp256, Key curve: nistp256, Key Len: 65, 0x04: 4\r\nx: [28, -84, 90, -128, 0, 98, 61, -104, 90, -49, 79, 89, 21, 21, 23, -64, -3, 46, 117, -59, 0, -105, 39, 5, -66, 87, -62, 89, 57, -126, 6, -116]\r\ny: [-65, 108, -82, -12, 38, 101, -34, -37, 109, -86, 55, -123, 6, 104, -120, -102, 32, -74, -26, 3, -3, -98, -53, -91, 121, 110, 126, -33, 23, 26, 111, 17]\r\n20:34:44.196 [main] DEBUG net.schmizz.sshj.common.ECDSAVariationsAdapter - Key algo: ecdsa-sha2-nistp256, Key curve: nistp256, Key Len: 65, 0x04: 4\r\nx: [-72, 47, -123, 101, 10, 62, 23, -24, 76, -119, -21, 126, -28, 89, 101, -67, -28, 19, -90, -62, 90, -55, -99, 43, 48, 54, -37, -13, 113, -97, -52, -65]\r\ny: [117, -6, -34, -15, -94, 107, -121, -47, 80, -96, -107, -115, 114, -85, 43, 95, -122, 30, 46, -81, -20, 44, -62, 124, -38, 78, 118, 109, 114, 68, -115, -52]\r\n20:34:44.288 [main] INFO net.schmizz.sshj.transport.TransportImpl - Client identity string: SSH-2.0-SSHJ_0.22.0\r\n20:34:44.350 [main] INFO net.schmizz.sshj.transport.TransportImpl - Server identity string: SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u6\r\n20:34:44.351 [main] DEBUG net.schmizz.concurrent.Promise - Setting <<kex done>> to `null`\r\n20:34:44.351 [main] DEBUG net.schmizz.sshj.transport.KeyExchanger - Sending SSH_MSG_KEXINIT\r\n20:34:44.355 [main] DEBUG net.schmizz.concurrent.Promise - Setting <<kexinit sent>> to `SOME`\r\n20:34:44.356 [main] DEBUG net.schmizz.concurrent.Promise - Awaiting <<kex done>>\r\n20:34:44.404 [reader] DEBUG net.schmizz.sshj.transport.KeyExchanger - Received SSH_MSG_KEXINIT\r\n20:34:44.405 [reader] DEBUG net.schmizz.sshj.transport.KeyExchanger - Negotiated algorithms: [ kex=diffie-hellman-group-exchange-sha256; sig=ecdsa-sha2-nistp256; c2sCipher=aes128-ctr; s2cCipher=aes128-ctr; c2sMAC=hmac-sha1; s2cMAC=hmac-sha1; c2sComp=none; s2cComp=none ]\r\n20:34:44.417 [reader] DEBUG net.schmizz.sshj.transport.kex.DHGexSHA256 - Sending KEX_DH_GEX_REQUEST\r\n20:34:44.465 [reader] DEBUG net.schmizz.sshj.transport.KeyExchanger - Received kex followup data\r\n20:34:44.465 [reader] DEBUG net.schmizz.sshj.transport.kex.DHGexSHA256 - Got message KEXDH_31\r\n20:34:44.466 [reader] DEBUG net.schmizz.sshj.transport.kex.DHGexSHA256 - Received server p bitlength 2048\r\n20:34:44.531 [reader] DEBUG net.schmizz.sshj.transport.kex.DHGexSHA256 - Sending KEX_DH_GEX_INIT\r\n20:34:44.592 [reader] DEBUG net.schmizz.sshj.transport.KeyExchanger - Received kex followup data\r\n20:34:44.593 [reader] DEBUG net.schmizz.sshj.transport.kex.DHGexSHA256 - Got message KEX_DH_GEX_REPLY\r\n20:34:44.593 [reader] DEBUG net.schmizz.sshj.common.ECDSAVariationsAdapter - Key algo: ecdsa-sha2-nistp256, Key curve: nistp256, Key Len: 65, 0x04: 4\r\nx: [-88, -11, -26, 69, -85, 2, -118, 79, 92, 4, 18, -44, 127, 90, 74, 19, -128, -98, -15, 28, -112, -81, -55, 67, -88, -23, 6, -94, 80, -106, 75, -16]\r\ny: [-3, -77, -104, 57, 6, -63, -30, 49, 62, -91, -31, -87, 90, 19, -80, -8, -87, -45, 24, 8, -46, 105, 96, 62, 74, -7, -91, 73, 97, -104, 57, -99]\r\n20:34:44.675 [reader] DEBUG net.schmizz.sshj.transport.KeyExchanger - Trying to verify host key with net.schmizz.sshj.transport.verification.OpenSSHKnownHosts@321cb9bc\r\n20:34:44.683 [reader] DEBUG net.schmizz.sshj.transport.KeyExchanger - Trying to verify host key with net.schmizz.sshj.transport.verification.OpenSSHKnownHosts@403b9b05\r\n20:34:44.686 [reader] ERROR net.schmizz.sshj.transport.TransportImpl - Dying because - Could not verify `ecdsa-sha2-nistp256` host key with fingerprint `98:5a:76:cb:99:77:f8:dc:ad:80:bc:7c:9c:e6:1c:f0` for `my.server` on port 22\r\nnet.schmizz.sshj.transport.TransportException: Could not verify `ecdsa-sha2-nistp256` host key with fingerprint `98:5a:76:cb:99:77:f8:dc:ad:80:bc:7c:9c:e6:1c:f0` for `my.server` on port 22\r\n\tat net.schmizz.sshj.transport.KeyExchanger.verifyHost(KeyExchanger.java:205)\r\n\tat net.schmizz.sshj.transport.KeyExchanger.handle(KeyExchanger.java:359)\r\n\tat net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:503)\r\n\tat net.schmizz.sshj.transport.Decoder.decode(Decoder.java:102)\r\n\tat net.schmizz.sshj.transport.Decoder.received(Decoder.java:170)\r\n\tat net.schmizz.sshj.transport.Reader.run(Reader.java:59)\r\n20:34:44.687 [reader] INFO net.schmizz.sshj.transport.TransportImpl - Disconnected - HOST_KEY_NOT_VERIFIABLE\r\n20:34:44.687 [reader] DEBUG net.schmizz.sshj.transport.KeyExchanger - Got notified of net.schmizz.sshj.transport.TransportException: [HOST_KEY_NOT_VERIFIABLE] Could not verify `ecdsa-sha2-nistp256` host key with fingerprint `98:5a:76:cb:99:77:f8:dc:ad:80:bc:7c:9c:e6:1c:f0` for `my.server` on port 22\r\n20:34:44.687 [reader] DEBUG net.schmizz.sshj.transport.TransportImpl$NullService - Notified of net.schmizz.sshj.transport.TransportException: [HOST_KEY_NOT_VERIFIABLE] Could not verify `ecdsa-sha2-nistp256` host key with fingerprint `98:5a:76:cb:99:77:f8:dc:ad:80:bc:7c:9c:e6:1c:f0` for `my.server` on port 22\r\n20:34:44.687 [reader] DEBUG net.schmizz.sshj.transport.TransportImpl - Setting active service to null-service\r\n20:34:44.687 [main] ERROR net.schmizz.concurrent.Promise - <<kex done>> woke to: net.schmizz.sshj.transport.TransportException: [HOST_KEY_NOT_VERIFIABLE] Could not verify `ecdsa-sha2-nistp256` host key with fingerprint `98:5a:76:cb:99:77:f8:dc:ad:80:bc:7c:9c:e6:1c:f0` for `my.server` on port 22\r\n20:34:44.687 [reader] DEBUG net.schmizz.sshj.transport.TransportImpl - Sending SSH_MSG_DISCONNECT: reason=[HOST_KEY_NOT_VERIFIABLE], msg=[Could not verify `ecdsa-sha2-nistp256` host key with fingerprint `98:5a:76:cb:99:77:f8:dc:ad:80:bc:7c:9c:e6:1c:f0` for `myserver` on port 22]\r\n20:34:44.688 [reader] DEBUG net.schmizz.concurrent.Promise - Setting <<transport close>> to `SOME`\r\n20:34:44.688 [reader] DEBUG net.schmizz.sshj.transport.Reader - Stopping\r\nnet.schmizz.sshj.transport.TransportException: [HOST_KEY_NOT_VERIFIABLE] Could not verify `ecdsa-sha2-nistp256` host key with fingerprint `98:5a:76:cb:99:77:f8:dc:ad:80:bc:7c:9c:e6:1c:f0` for `myserver` on port 22\r\n\tat net.schmizz.sshj.transport.KeyExchanger.verifyHost(KeyExchanger.java:205)\r\n\tat net.schmizz.sshj.transport.KeyExchanger.handle(KeyExchanger.java:359)\r\n\tat net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:503)\r\n\tat net.schmizz.sshj.transport.Decoder.decode(Decoder.java:102)\r\n\tat net.schmizz.sshj.transport.Decoder.received(Decoder.java:170)\r\n\tat net.schmizz.sshj.transport.Reader.run(Reader.java:59)\r\n```\r\n\r\nI can ssh from my Linux box to the machine without any issues, so the known_hosts file is fine and is in the following format:\r\n```\r\n|1|foo...|foo...= ecdsa-sha2-nistp256\r\n```\r\n\r\nNB: it is extremely ugly to throw an exception from a different thread since it is impossible to see where exactly in my code the SSH connection failed! Please rewrap the exception in sshj so that both the original thread stacktrace and my thread stacktrace is visible."}}
{"actor":{"display_login":"mvysny"}}