aboutsummaryrefslogtreecommitdiff
path: root/sign.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-07-17 13:08:48 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-07-17 13:08:48 +0200
commit4b7ed3d169dd0b4ce40f2a17cc049c055d5ba7a3 (patch)
tree92c7de0d9d20155078d38d129940944b23dd82fe /sign.go
parent0984f30f10b5caaa54e3047aa99194478fb20a90 (diff)
Rollback flags
Diffstat (limited to 'sign.go')
-rw-r--r--sign.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/sign.go b/sign.go
index 36d8b32..571ee5a 100644
--- a/sign.go
+++ b/sign.go
@@ -15,30 +15,30 @@ import (
func sign(args []string) error {
opts := flag.NewFlagSet("sign", flag.ExitOnError)
var (
- embedded = *opts.Bool("e", false, "Embed the message")
- zip = *opts.Bool("z", false, "Sign gzip archive") // TODO
- sigFile = *opts.String("x", "", "Signature file")
- encFile = *opts.String("s", "", "Secret file (required)")
- msgFile = *opts.String("m", "", "Message file (required)")
+ embedded = opts.Bool("e", false, "Embed the message")
+ zip = opts.Bool("z", false, "Sign gzip archive") // TODO
+ sigFile = opts.String("x", "", "Signature file")
+ encFile = opts.String("s", "", "Secret file (required)")
+ msgFile = opts.String("m", "", "Message file (required)")
)
opts.Parse(args)
- if embedded && zip {
+ if *embedded && *zip {
return errors.New("can't combine -e and -z options")
}
- if encFile == "" || msgFile == "" {
+ if *encFile == "" || *msgFile == "" {
opts.Usage()
return nil
}
- if sigFile == "" {
- sigFile = file.SigName(msgFile)
+ if *sigFile == "" {
+ *sigFile = file.SigName(*msgFile)
}
_ = zip // TODO
- encKey, err := OpenEnc(encFile)
+ encKey, err := OpenEnc(*encFile)
if err != nil {
return err
}
- body, err := ioutil.ReadFile(msgFile)
+ body, err := ioutil.ReadFile(*msgFile)
if err != nil {
return err
}
@@ -48,13 +48,13 @@ func sign(args []string) error {
return err
}
block := &file.Block{
- Comment: file.VerifyWith(encFile),
+ Comment: file.VerifyWith(*encFile),
Bytes: raw,
}
- if embedded {
+ if *embedded {
block.Message = body
}
- if err := file.EncodeFile(sigFile, file.SigMode, block); err != nil {
+ if err := file.EncodeFile(*sigFile, file.SigMode, block); err != nil {
return err
}
return nil