2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SSH の id_rsa.pub を RFC4716 形式で出力する

Posted at

Microsoft の Azule で仮想PCを作成しようとしたら SSH の公開鍵を要求されて、id_rsa.pub の内容をコピペしたら ''---- BEGIN SSH2 PUBLIC KEY ----'' で始まる形式にしろと言われたので変換。

$ ssh-keygen -e -f ~/.ssh/id_rsa.pub
---- BEGIN SSH2 PUBLIC KEY ----
Comment: "2048-bit RSA, converted by suisui from Ope"
<BASE64 ENCODED KEY ...>
---- END SSH2 PUBLIC KEY ----

逆向きの変換は、先に検索でヒットしたのだけど、自分の欲しい出力が RFC4716 形式だったので。何のことはない ssh-keygen --help を読めば書いてあった

逆 (IN: RFC4716 -> OUT: SSH2)

タイトルとは逆の変換

$ ssh-keygen -i -f rfc4716.pub
ssh-rsa <BASE64 ENCODED KEY ...> <COMMENT>
2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?