Skip to content

Commit

Permalink
adding gencurve
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo committed Dec 4, 2019
1 parent b238ad3 commit 7d0613c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cmd/gencurve.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cmd

import (
"fmt"
"github.com/pebbe/zmq4"
"github.com/spf13/cobra"
)

var genCurveCmd = &cobra.Command{
Use: "generate-curve",
Short: "Returns a Public Key and a Private Key usable in the system",
RunE: func(cmd *cobra.Command, args []string) error {
pk, sk, err := zmq4.NewCurveKeypair()
if err != nil {
return fmt.Errorf("Cannot generate curve key pair")
}
fmt.Printf("Public Key: %s\n", pk)
fmt.Printf("Private Key: %s\n", sk)
return nil
},
}
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

func init() {
rootCmd.AddCommand(rsaCmd)
rootCmd.AddCommand(genCurveCmd)
Log = log.New(os.Stderr, "", 0)
}

Expand Down

0 comments on commit 7d0613c

Please sign in to comment.