473,461 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

SshPrivateKeyFile-- Private key is not in the default format

112 100+
Hi,
I am trying to authentic using a public key but I get the error: Private key is not in the default format

Can someone please help me change the format of my private key file.

HERE IS MY CODE:
Expand|Select|Wrap|Line Numbers
  1. //Authenticate using a public key
  2.            PublicKeyAuthenticationClient pk = new PublicKeyAuthenticationClient();
  3.            pk.setUsername(user);
  4.            System.out.println("I got past the authenticate the public key");
  5.  
  6.            // open up the private key file
  7.            SshPrivateKey key = null;
  8.  
  9.            File hostsFile = new File("$HOME/.ssh/known_hosts");
  10.  
  11.  
  12.            SshPrivateKeyFile file = SshPrivateKeyFile.parse(hostsFile);
  13.  
  14.  
  15.            key = file.toPrivateKey(password);
  16.  
  17.            pk.setKey(key);
  18.  
  19.            int result = ssh.authenticate(pk);
  20.  
  21.  
HERE IS MY RESULTS WITH THE ERROR:
ISCONNECTED: true
I got past the authenticate the public key
Sep 21, 2010 12:31:43 PM com.sshtools.j2ssh.transport.publickey.SshPrivateK eyFile parse
INFO: Parsing private key file
Sep 21, 2010 12:31:43 PM com.sshtools.j2ssh.transport.publickey.SshPrivateK eyFile parse
INFO: Private key is not in the default format, attempting parse with other supported formats
YOU FAILED IN THE CONNECT
Error: com.sshtools.j2ssh.transport.publickey.InvalidSshK eyException: The key format is not a supported format



THANKS A LOT FOR THE HELP!!
Sep 21 '10 #1
0 1214

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: Andrew J. Marshall | last post by:
I want to create a class that must receive a parameter when instantiated. In other words, I do not want it to have a "Public Sub New()". 1) Does VB.NET create a default public constructor if I do...
3
by: swengtoo | last post by:
In his book "More Effective C++", Scott Meyer suggests in "Item 4" to "Avoid gratuitous default constructors". To summarize his claims against default constructors for "the right classes" he...
3
by: Matt | last post by:
Does the standard define default values for the format state of an ostream? I would like to be able to put a stream in a standard format state without thinking about how some other routine may...
1
by: aplocher | last post by:
Hello, I was wondering if there was any way to change the default format of the ASP.NET 2.0 ReportViewer control to be a PDF. I want only IE to render in HTML defaultly, whereas Firefox and Opera...
9
by: Alok yadav | last post by:
i am using a webservice in which a method is serach. i use this method which accept a argument of date type in dd/MM/yyyy formate. i have a textbox which accept the date from the user, when i...
2
by: KMG | last post by:
Where does Visual Studio 2003 get its default formats? For instance I have an asp page with a few textboxes, checkboxes, lists, a form, tables, etc. I have no style sheet and no values are set to...
8
by: yashiro | last post by:
Hello i Have a database in SQLserver. I am using php to connect to it and to retrieve data from that database. I have a table with a column (DATATIME) where i do : $result =...
5
by: mc | last post by:
Hello, I'm trying to create a class (A) with a default constructor friend to another one (B) as follows: class A { public: A(int a); ~A();
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.