diff options
author | fuero <fuero@users.noreply.github.com> | 2017-06-05 23:28:13 +0200 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2017-06-05 22:28:13 +0100 |
commit | 321e26fae746e661d713cedfb6642609e680cafe (patch) | |
tree | 4be9496c75aabc54325aac1b8b511223e986b8f7 /vendor/github.com/mikesmitty/edkey/README.md | |
parent | 8ee3c6473f3e2373303b9cb16ab5f059f9e6369e (diff) |
Saving private keys (#61)
* enables saving private keys
* renames public_file_prefix to key_file_prefix and updates its docs to better reflect the changes
Diffstat (limited to 'vendor/github.com/mikesmitty/edkey/README.md')
-rw-r--r-- | vendor/github.com/mikesmitty/edkey/README.md | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/vendor/github.com/mikesmitty/edkey/README.md b/vendor/github.com/mikesmitty/edkey/README.md new file mode 100644 index 0000000..a1690ae --- /dev/null +++ b/vendor/github.com/mikesmitty/edkey/README.md @@ -0,0 +1,32 @@ +# edkey +edkey allows you to marshal/write ED25519 private keys in the OpenSSH private key format + +## Example +```go +package main + +import ( + "crypto/rand" + "encoding/pem" + "io/ioutil" + "github.com/mikesmitty/edkey" + "golang.org/x/crypto/ed25519" + "golang.org/x/crypto/ssh" +) + +func main() { + // Generate a new private/public keypair for OpenSSH + pubKey, privKey, _ := ed25519.GenerateKey(rand.Reader) + publicKey, _ := ssh.NewPublicKey(pubKey) + + pemKey := &pem.Block{ + Type: "OPENSSH PRIVATE KEY", + Bytes: edkey.MarshalED25519PrivateKey(privKey), + } + privateKey := pem.EncodeToMemory(pemKey) + authorizedKey := ssh.MarshalAuthorizedKey(publicKey) + + _ = ioutil.WriteFile("id_ed25519", privateKey, 0600) + _ = ioutil.WriteFile("id_ed25519.pub", authorizedKey, 0644) +} +``` |