diff --git a/cmd/bitxhub/cert.go b/cmd/bitxhub/cert.go index e2e3cb1..e41adef 100644 --- a/cmd/bitxhub/cert.go +++ b/cmd/bitxhub/cert.go @@ -398,6 +398,11 @@ func generatePrivKey(ctx *cli.Context, opt crypto.KeyType) error { name := ctx.String("name") target := ctx.String("target") + target, err := filepath.Abs(target) + if err != nil { + return fmt.Errorf("get absolute key path: %w", err) + } + privKey, err := asym.GenerateKeyPair(opt) if err != nil { return fmt.Errorf("generate key: %w", err) @@ -425,5 +430,6 @@ func generatePrivKey(ctx *cli.Context, opt crypto.KeyType) error { return fmt.Errorf("pem encode: %w", err) } + fmt.Printf("%s.priv key is generated under directory %s\n", name, target) return nil } diff --git a/cmd/bitxhub/key.go b/cmd/bitxhub/key.go index bbadf66..dd65015 100755 --- a/cmd/bitxhub/key.go +++ b/cmd/bitxhub/key.go @@ -19,7 +19,7 @@ func keyCMD() cli.Command { Subcommands: []cli.Command{ { Name: "gen", - Usage: "Create new Secp256k1 private key", + Usage: "Create new Secp256k1 private key in specified directory", Flags: []cli.Flag{ cli.StringFlag{ Name: "name",