在Go中创建或使用GPG或SSH密钥的方法

huangapple go评论81阅读模式
英文:

Creating or using GPG or SSH keys directly in Go

问题

有没有一些方便的示例、库等可以从Go的crypto/rsa中读取/保存RSA PublicKey和/或PrivateKey类型到GnuPG或OpenSSH密钥格式?显然,编写这个并不难,但肯定有一个良好的例程存在,即使不是针对GnuPG或SSH,也可以转换为OpenSSL,可以将其转换为这些格式

英文:

Are there any handy examples, libraries, etc. that read/save the RSA PublicKey and/or PrivateKey types from Go's crypto/rsa from/to GnuPG or OpenSSH key formats?

It's obviously not hard to write this, but surely a well routine is out there, if not for GnuPG or SSH then for OpenSSL, which can be converted to those.

答案1

得分: 1

所有与SSH相关的方法都在golang.org/x/crypto/ssh中(或者现在是2014年12月:github.com/golang/crypto/tree/master/ssh,因为Go切换到了GitHub!)。
读取/保存RSA密钥是在crypto/x509中进行管理的,正如OP Jeff Burdges所指出的那样。

你可以在这个项目Scalingo/go-ssh-examples中看到一个很好的例子,它实现了一个SSH服务器(!)和客户端。
这也在文章"使用Go编写一个替代OpenSSH的工具"中有所描述。

英文:

All ssh-related methods are in golang.org/x/crypto/ssh
(or now Dec. 2014: github.com/golang/crypto/tree/master/ssh, since Go switches to GitHub!).
Read/Save RSA keys is manage in crypto/x509, as noted by the OP Jeff Burdges.

You can see a good example in this project Scalingo/go-ssh-examples, which implements an ssh server(!) and client.
It is also described in the article "Writing a replacement to OpenSSH using Go".

huangapple
  • 本文由 发表于 2014年12月8日 11:58:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/27351194.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定