Skip to content

Commit

Permalink
AAD support
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroalbanese authored Dec 6, 2022
1 parent 03e15d0 commit ae1c0ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

var (
aad = flag.String("a", "", "Additional Associated data.")
dec = flag.Bool("d", false, "Decrypt instead Encrypt.")
file = flag.String("f", "", "Target file. ('-' for STDIN)")
iter = flag.Int("i", 1024, "Iterations. (for PBKDF2)")
Expand Down Expand Up @@ -97,7 +98,7 @@ func main() {
log.Fatal(err)
}

out := aead.Seal(nonce, nonce, msg, nil)
out := aead.Seal(nonce, nonce, msg, []byte(*aad))
fmt.Printf("%s", out)

os.Exit(0)
Expand All @@ -106,7 +107,7 @@ func main() {
if *dec == true {
nonce, msg := msg[:aead.NonceSize()], msg[aead.NonceSize():]

out, err := aead.Open(nil, nonce, msg, nil)
out, err := aead.Open(nil, nonce, msg, []byte(*aad))
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit ae1c0ab

Please sign in to comment.