diff options
| author | ishaan <contact@ishaan.cc> | 2026-07-15 07:51:06 +0530 |
|---|---|---|
| committer | ishaan <contact@ishaan.cc> | 2026-07-15 07:51:06 +0530 |
| commit | d369e5611df643bd83f951a94b468ef272c1bf3e (patch) | |
| tree | e9b12ca81bafc53cfad7933578f2665e183bf4f2 /cmd/eno/cobra.go | |
| parent | 8ebc072fb0ceae229196e8d3d8ff15bbbc049fdd (diff) | |
bunch of fixes
defer file.Close() after os.OpenFile
clear(sensitive) before each os.Exit(1)
Shared utils.StdinScanner with 512KB buffer
bytes.Equal for password comparison, append instead of string() + []byte()
Diffstat (limited to 'cmd/eno/cobra.go')
| -rw-r--r-- | cmd/eno/cobra.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/eno/cobra.go b/cmd/eno/cobra.go index 4a7443e..cf373d5 100644 --- a/cmd/eno/cobra.go +++ b/cmd/eno/cobra.go @@ -70,6 +70,7 @@ var encryptCmd = &cobra.Command{ } encrypted, _, err := crypt.EncryptBytesSSH(fileBytes, pubKeys) if err != nil { + clear(fileBytes) cmd.PrintErrln("Error:", err) os.Exit(1) } @@ -91,6 +92,8 @@ var encryptCmd = &cobra.Command{ encrypted, err := crypt.EncryptBytesPass(fileBytes, password) if err != nil { + clear(fileBytes) + clear(password) cmd.PrintErrln("Error:", err) os.Exit(1) } @@ -166,6 +169,7 @@ var decryptCmd = &cobra.Command{ plaintext, err := crypt.DecryptBytesPass(fileBytes, password) if err != nil { + clear(password) cmd.PrintErrln("Error:", err) os.Exit(1) } |