PowerShell / PowerShell/Win32-OpenSSH

ssh-keygen fails to convert pkcs8 public key to ssh

Open
#1,400 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Bug
Dominant language
No language data
Stars
8.3k
Forks
819
PR merge metrics
No merged PRs in 30d

Description

Troubleshooting steps
https://github.com/PowerShell/Win32-OpenSSH/wiki/Troubleshooting-Steps
None: ssh-keygen outputs nothing (for error or output).

Terminal issue? please go through wiki
https://github.com/PowerShell/Win32-OpenSSH/wiki/TTY-PTY-support-in-Windows-OpenSSH

Please answer the following

"OpenSSH for Windows" version
((Get-Item (Get-Command sshd).Source).VersionInfo.FileVersion)
7.9.0.0

Server OperatingSystem
((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion\" -Name ProductName).ProductName)

Client OperatingSystem
Windows 10 Pro

What is failing
ssh-keygen fails to return any output when attempting to convert a PKCS8 format public key to the ssh format using the following command:

ssh-keygen -i -m pkcs8 -f test_user.pub

(Assume test_user.pub is a properly encoded text file with the following content:
-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvbGb+89PZgb8wzJe/WQ0 8igeoFPyEfxPeDV1T3JPPpolMWPaW92JGzOgcpQ7YgvWtLVS6HEC5/oWhaMrUljS Nh5DAkPgNvt7RoEDJWGbdHMD69W5Ab8omq8+RqpXBaqEfLGo+QII/s3mRcG3lBXM +3dw8ns4M/vKa66lDlE1moD6yzDnjz5PhgB72LyfqaTJR4KAb2mS5LDuN5PgUP+X gXCxgAX0sbuV3lpH72bQ92cIZEnLbfdtnsMhkCnhkrb2P6uZ9hjyNRovdpppMBwe U4+n1BYHNAiwTesE9O6VSIPhzjNqELxptXsXArnuJLBL4tMnmrDX38LnvQqWMnR/ NQIDAQAB -----END PUBLIC KEY----- )

Expected output
On Linux, mac and the Git for Windows, the above command for the given test_user.pub, returns the following:
$ ssh-keygen -i -m pkcs8 -f test_user.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9sZv7z09mBvzDMl79ZDTyKB6gU/IR/E94NXVPck8+miUxY9pb3YkbM6BylDtiC9a0tVLocQLn+haFoytSWNI2HkMCQ+A2+3tGgQMlYZt0cwPr1bkBvyiarz5GqlcFqoR8saj5Agj+zeZFwbeUFcz7d3Dyezgz+8prrqUOUTWagPrLMOePPk+GAHvYvJ+ppMlHgoBvaZLksO43k+BQ/5eBcLGABfSxu5XeWkfvZtD3ZwhkSctt922ewyGQKeGStvY/q5n2GPI1Gi92mmkwHB5Tj6fUFgc0CLBN6wT07pVIg+HOM2oQvGm1excCue4ksEvi0yeasNffwue9CpYydH81

Actual output
Using the Windows port, it returns nothing:

PS C:\> ssh-keygen -i -m pkcs8 -f .\test_user.pub PS C:\>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing ssh-keygen -i -m pkcs8 -f .\test_user.pub on Windows 10 with the supplied test_user.pub, then compare it with the Linux, macOS, and Git for Windows results described in the issue. Trace the ssh-keygen import path responsible for PKCS8 public keys; done means the Windows port produces the expected SSH public-key output or reports a useful error.

Written by the indexing model from the issue text.

Assessment

Domain
cli, cryptography
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.