diff options
Diffstat (limited to 'cmd/gitolfs3-gen-ed25519-key')
-rw-r--r-- | cmd/gitolfs3-gen-ed25519-key/main.go | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/cmd/gitolfs3-gen-ed25519-key/main.go b/cmd/gitolfs3-gen-ed25519-key/main.go deleted file mode 100644 index 8288fd1..0000000 --- a/cmd/gitolfs3-gen-ed25519-key/main.go +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | package main | ||
2 | |||
3 | import ( | ||
4 | "crypto/ed25519" | ||
5 | "crypto/rand" | ||
6 | "encoding/hex" | ||
7 | "fmt" | ||
8 | "os" | ||
9 | ) | ||
10 | |||
11 | func wipe(b []byte) { | ||
12 | for i := range b { | ||
13 | b[i] = 0 | ||
14 | } | ||
15 | } | ||
16 | |||
17 | func main() { | ||
18 | publicKey, privateKey, err := ed25519.GenerateKey(rand.Reader) | ||
19 | if err != nil { | ||
20 | fmt.Fprintf(os.Stderr, "Failed to generate ED25519 key: %s", err) | ||
21 | os.Exit(1) | ||
22 | } | ||
23 | defer wipe(privateKey) | ||
24 | |||
25 | enc := hex.NewEncoder(os.Stdout) | ||
26 | print("Public ") | ||
27 | enc.Write(publicKey) | ||
28 | print("\nPrivate ") | ||
29 | enc.Write(privateKey.Seed()) | ||
30 | println() | ||
31 | } | ||