title: Teamcity SSH private key login failed: invalid privatekey
body: <p>I set SSH login which connect from Windows Agent to Linux but TeamCity gives following error.</p>
  
  <blockquote>
    <p>[New build problem] com.jcraft.jsch.JSchException: invalid privatekey: [B@5543cd</p>
  </blockquote>
  
  <p>The keypair which generated by SSH Secure Shell has no problem to connect to server.</p>
  
  <p>Similar question is <a href="https://stackoverflow.com/questions/14276246/jsch-getting-invalid-privatekey-while-trying-to-load-an-rsa-private-key-by-ke">here</a> but it's not my programmatic problem but teamcity inner exception.</p>
  
  <p>Note that my problem is not a case of GitHub VCS connectivity issue. just a problem between my Windows TeamCity Agent to CentOS Linux server.</p>
  
  <p>Full stacktrace is as below.</p>
  
  <blockquote>
    <p>[Step 6/8] com.jcraft.jsch.JSchException: invalid privatekey: [B@5543cd at com.jcraft.jsch.KeyPair.load(KeyPair.java:702) at com.jcraft.jsch.KeyPair.load(KeyPair.java:542) at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:40) at com.jcraft.jsch.JSch.addIdentity(JSch.java:389) at com.jcraft.jsch.JSch.addIdentity(JSch.java:349) at jetbrains.buildServer.deployer.agent.ssh.SSHSessionProvider.initSessionKeyFile(SSHSessionProvider.java:110) at jetbrains.buildServer.deployer.agent.ssh.SSHSessionProvider.(SSHSessionProvider.java:80) at jetbrains.buildServer.deployer.agent.ssh.SSHExecRunner.createBuildProcess(SSHExecRunner.java:26) at jetbrains.buildServer.agent.impl.runner.CallRunnerService.doCreateBuildProcess(CallRunnerService.java:71) at jetbrains.buildServer.agent.impl.runner.CallRunnerService.createBuildProcess(CallRunnerService.java:47) at jetbrains.buildServer.agent.impl.buildStages.runnerStages.start.CallRunnerStage.doBuildStage(CallRunnerStage.java:47) at jetbrains.buildServer.agent.impl.buildStages.RunnerStagesExecutor$1.callStage(RunnerStagesExecutor.java:25) at jetbrains.buildServer.agent.impl.buildStages.RunnerStagesExecutor$1.callStage(RunnerStagesExecutor.java:18) at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.callRunStage(StagesExecutor.java:78) at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.doStages(StagesExecutor.java:37) at jetbrains.buildServer.agent.impl.buildStages.RunnerStagesExecutor.doStages(RunnerStagesExecutor.java:18) at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.RunnerContextExecutor.callRunnerStages(RunnerContextExecutor.java:43) at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.StepExecutor.processNextStep(StepExecutor.java:25) at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.ForEachBuildRunnerStage.executeRunnerStep(ForEachBuildRunnerStage.java:138) at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.ForEachBuildRunnerStage.runStep(ForEachBuildRunnerStage.java:123) at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.ForEachBuildRunnerStage.executeBuildRunners(ForEachBuildRunnerStage.java:83) at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.ForEachBuildRunnerStage.doBuildStage(ForEachBuildRunnerStage.java:44) at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor$1.callStage(BuildStagesExecutor.java:31) at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor$1.callStage(BuildStagesExecutor.java:24) at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.callRunStage(StagesExecutor.java:78) at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.doStages(StagesExecutor.java:37) at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor.doStages(BuildStagesExecutor.java:24) at jetbrains.buildServer.agent.impl.BuildRunAction.doStages(BuildRunAction.java:70) at jetbrains.buildServer.agent.impl.BuildRunAction.runBuild(BuildRunAction.java:50) at jetbrains.buildServer.agent.impl.BuildAgentImpl.doActualBuild(BuildAgentImpl.java:263) at jetbrains.buildServer.agent.impl.BuildAgentImpl.access$100(BuildAgentImpl.java:50) at jetbrains.buildServer.agent.impl.BuildAgentImpl$1.run(BuildAgentImpl.java:236) at java.lang.Thread.run(Thread.java:744)</p>
  </blockquote>