Error when trying to connect to SSH linux using OpenSSH Key with Passphrase
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 993
- Avg merge
- 9d 21h
- Merged PRs (30d)
- 1
Description
Getting below error when trying to connect to SSH linux machine using OpenSSH Key with passphrase.
Error 1 - DER length is '26' and cannot be more than 4 bytes
Error 2 - Invalid data type, INTEGER(02) is expected, but was 73
Using Below code from Renci.sshnet -
using (var stream = new FileStream(sshkey, FileMode.Open, FileAccess.Read))
{
Conninfo = new ConnectionInfo(Gip, Convert.ToInt32(Gport), Guser,
new AuthenticationMethod[]{
// Key Based Authentication (using keys in OpenSSH Format)
new PrivateKeyAuthenticationMethod(Guser, new PrivateKeyFile[]{
new PrivateKeyFile(stream,Gpass)
}),
}
);
}
Above code execution gives error when i use sshkey with Passphrase.
Anyone please help here if you have faced same issue when login via sshkey.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure through PrivateKeyFile and PrivateKeyAuthenticationMethod with the passphrase-protected OpenSSH key described in the issue. Trace the key parsing path to identify where the DER length and INTEGER errors originate. Done means the reported key can authenticate successfully, with regression coverage for the passphrase case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100