OpenSSH Private Key - WeOnlyDo Discussion board

OpenSSH Private Key (wodVPN)

by Rodney Trugman, Thursday, June 02, 2005, 19:16 (7112 days ago)

I have a OpenSSH generated private key in the following format in the file. How do I load the key into Ssh1.PrivateKey field via C# .NET.

----BEGIN DSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,D16600A198B49E0C

TmdiwoDtuBKJva5poBDKN0DSUBybl5z1uhi1lcFFSwz3Nc/lrnKIiPJ5qeVzsXjj
svkzDB7DGIU5iiciuRsWZ4u7EJzLPiP20fvho6JB8FAR+z08RsVZdwd9FekHRv5n
.
.
.
UHyHaYu7cosEL0EXqd225ritHSzsnPve8HgxDLys+pVn7IEQvlUOhur24ZgNufMc
I8atnB1//vPNDgw7bOWJ2A==
-----END DSA PRIVATE KEY-----

Re: OpenSSH Private Key

by wodSupport, Thursday, June 02, 2005, 20:30 (7112 days ago) @ Rodney Trugman

Rodney,

wodKeyManager component comes with wodSSH.NET. Use its Load method to load the key, and then it's PrivateKey property to pass value of the key to wodSSH.NET.

Can you try that?

Re: OpenSSH Private Key

by Rodney Trugman, Thursday, June 02, 2005, 21:32 (7112 days ago) @ wodSupport

I tried the load and get a trap:

An unhandled exception of type 'System.Exception' occurred in weonlydo.security.cryptography.keymanager.dll

Additional information: Failed to import key from file.

The code is from the sample app.

WeOnlyDo.Security.Cryptography.KeyManager km = new WeOnlyDo.Security.Cryptography.KeyManager();
WeOnlyDo.Security.Cryptography.SSHKeyTypes type = km.Load(textBox4.Text);
Console.WriteLine(km.PublicKeyOpenSSH(type));
Ssh1.PrivateKey = km.PrivateKey(type);

I can send you the key file if you want.

Re: OpenSSH Private Key

by wodSupport, Thursday, June 02, 2005, 21:35 (7112 days ago) @ Rodney Trugman

Yes please, send it to techsupport@weonlydo.com , make sure you send the password too.

Re: OpenSSH Private Key

by wodSupport, Thursday, June 02, 2005, 22:06 (7112 days ago) @ wodSupport

It worked pretty much straightforward with your key. Here's my code:
[code]WeOnlyDo.Security.Cryptography.KeyManager km = new WeOnlyDo.Security.Cryptography.KeyManager();
WeOnlyDo.Security.Cryptography.SSHKeyTypes type;
type = km.Load( privatekey.dat , ******** );
MessageBox.Show(km.PublicKeyOpenSSH(type), Public key );[/code]

Hope it helps.