Commit cc61b43a authored by Sietse Ringers's avatar Sietse Ringers
Browse files

feat: improve error messages of irma keyshare keygen

parent 3119eb19
......@@ -11,27 +11,30 @@ import (
var keyshareKeygen = &cobra.Command{
Use: "keygen",
Short: "Generate storage key for keyshare server",
RunE: func(command *cobra.Command, args []string) error {
Run: func(command *cobra.Command, args []string) {
filename, err := command.Flags().GetString("key-file")
if err != nil {
return err
die("", err)
}
counter, err := command.Flags().GetUint32("counter")
if err != nil {
return err
die("", err)
}
key, err := keysharecore.GenerateAESKey()
if err != nil {
return err
die("", err)
}
keydata := make([]byte, 4+len(key[:]))
binary.LittleEndian.PutUint32(keydata, counter)
copy(keydata[4:], key[:])
return ioutil.WriteFile(filename, keydata, 0600)
err = ioutil.WriteFile(filename, keydata, 0600)
if err != nil {
die("", err)
}
},
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment