TimothyYe / skm

A simple and powerful SSH keys manager
https://timothyye.github.io/skm
MIT License
954 stars 54 forks source link

id_rsa can't transfer to pem formate #34

Closed JayceLau closed 3 years ago

JayceLau commented 3 years ago

Private key, which created by skm, can't be transferred to pem format, the error is below:

140138626492304:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:707:Expecting: ANY PRIVATE KEY

My command is openssl rsa -in ./id_rsa -out id_rsa.pem.

TimothyYe commented 3 years ago

Hello, what command did you use to create the private key? Actually, SKM just calls ssh-keygen to create SSH public/private keys.

TimothyYe commented 3 years ago

https://github.com/TimothyYe/skm/blob/master/cmd/skm/actions.go#L149

JayceLau commented 3 years ago

skm create test -C test

Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/jayce/.skm/test/id_rsa.
Your public key has been saved in /Users/jayce/.skm/test/id_rsa.pub.
The key fingerprint is:
SHA256:ciCDxaz7gvDSz3TUsrfleJSX/fOqmkrYnqNnKlRbEcA test
The key's randomart image is:
+---[RSA 3072]----+
|   o......       |
|   oo E .        |
|  ..o .  .       |
|  .  o.o.        |
|   . .+oS  . o   |
|. . ...B  o o .  |
|.+ o. + +...   . |
|o +oo. ++*..   ..|
| . oo.o=*++.....+|
+----[SHA256]-----+
✔ SSH key [test] created!
cd test/
openssl rsa -in ./id_rsa -out id_rsa.pem
unable to load Private Key
4534541996:error:09FFF06C:PEM routines:CRYPTO_internal:no start line:/System/Volumes/Data/SWE/macOS/BuildRoots/e90674e518/Library/Caches/com.apple.xbs/Sources/libressl/libressl-56.60.2/libressl-2.8/crypto/pem/pem_lib.c:684:Expecting: ANY PRIVATE KEY
JayceLau commented 3 years ago

Sorry, my Command is wrong. I can do the transformation by this link. Thx for your answer.