https://github.com/mikesmitty/edkey
edkey allows you to write ED25519 private keys in the OpenSSH private key format
https://github.com/mikesmitty/edkey
ed25519 golang openssh privatekey
Last synced: 2 months ago
JSON representation
edkey allows you to write ED25519 private keys in the OpenSSH private key format
- Host: GitHub
- URL: https://github.com/mikesmitty/edkey
- Owner: mikesmitty
- License: mit
- Created: 2017-02-20T05:27:56.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-02T08:42:12.000Z (over 2 years ago)
- Last Synced: 2025-08-13T20:16:42.510Z (10 months ago)
- Topics: ed25519, golang, openssh, privatekey
- Language: Go
- Size: 3.91 KB
- Stars: 63
- Watchers: 3
- Forks: 20
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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)
}
```