aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--file/names.go14
-rw-r--r--main.go12
2 files changed, 13 insertions, 13 deletions
diff --git a/file/names.go b/file/names.go
index 265117e..f8bfa58 100644
--- a/file/names.go
+++ b/file/names.go
@@ -7,18 +7,18 @@ import (
var ErrNames = errors.New("please use naming scheme of keyname.pub and keyname.sec")
-func Names(pubFile, secFile string) error {
+func Names(pubFile, encFile string) error {
pubFile = filepath.Base(pubFile)
- secFile = filepath.Base(secFile)
+ encFile = filepath.Base(encFile)
pubExt := filepath.Ext(pubFile)
- secExt := filepath.Ext(secFile)
- if pubExt != ".pub" || secExt != ".sec" || pubFile[:len(pubExt)-1] != secFile[:len(secExt)-1] {
+ encExt := filepath.Ext(encFile)
+ if pubExt != ".pub" || encExt != ".sec" || pubFile[:len(pubExt)-1] != encFile[:len(encExt)-1] {
return ErrNames
}
return nil
}
-func PubName(secFile string) string {
- ext := filepath.Ext(secFile)
- return filepath.Base(secFile[:len(ext)-1] + ".pub")
+func PubName(encFile string) string {
+ ext := filepath.Ext(encFile)
+ return filepath.Base(encFile[:len(ext)-1] + ".pub")
}
diff --git a/main.go b/main.go
index 4471418..f969841 100644
--- a/main.go
+++ b/main.go
@@ -57,8 +57,8 @@ func main() {
}
}
-func Generate(pubFile, secFile, comment string, nopass bool) error {
- if err := file.Names(pubFile, secFile); err != nil {
+func Generate(pubFile, encFile, comment string, nopass bool) error {
+ if err := file.Names(pubFile, encFile); err != nil {
return err
}
@@ -81,7 +81,7 @@ func Generate(pubFile, secFile, comment string, nopass bool) error {
Comment: fmt.Sprintf("%s secret key", comment),
Bytes: encRaw,
}
- if err := file.EncodeFile(secFile, file.SecMode, sfile); err != nil {
+ if err := file.EncodeFile(encFile, file.SecMode, sfile); err != nil {
return err
}
@@ -153,8 +153,8 @@ func OpenSig(fname string) (*signify.Sig, []byte, error) {
return sig, msg, nil
}
-func Sign(msgFile, secFile string, embed bool) error {
- encKey, err := OpenEnc(secFile)
+func Sign(msgFile, encFile string, embed bool) error {
+ encKey, err := OpenEnc(encFile)
if err != nil {
return err
}
@@ -168,7 +168,7 @@ func Sign(msgFile, secFile string, embed bool) error {
return err
}
sigfile := &file.Block{
- Comment: fmt.Sprintf("verify with %s", file.PubName(secFile)),
+ Comment: fmt.Sprintf("verify with %s", file.PubName(encFile)),
Bytes: sigRaw,
}
if embed {