aboutsummaryrefslogtreecommitdiff
path: root/internal/crypt/rawEncrypt.go
diff options
context:
space:
mode:
authorishaan <contact@ishaan.cc>2026-07-12 16:41:00 +0530
committerishaan <contact@ishaan.cc>2026-07-12 16:41:00 +0530
commit050db499d18c61d90a68096027ac0d5aaa842f57 (patch)
tree2d0cd6db07407c2d44c8ea7ec899fb3088766d01 /internal/crypt/rawEncrypt.go
parent7b5328536a82755c2724f2075c31035d709588df (diff)
add init/new/edit subcommands, config, mlock/cleared sensitive info
Diffstat (limited to 'internal/crypt/rawEncrypt.go')
-rw-r--r--internal/crypt/rawEncrypt.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/internal/crypt/rawEncrypt.go b/internal/crypt/rawEncrypt.go
index 77803e0..f197650 100644
--- a/internal/crypt/rawEncrypt.go
+++ b/internal/crypt/rawEncrypt.go
@@ -23,6 +23,8 @@ func EncryptRawBytes(inputBytes []byte, password []byte) ([]byte, error) {
headers := utils.FileHeaders{Salt: salt, Nonce: nonce}
key := argon2.IDKey(password, headers.Salt[:], 1, 2*1024*1024, 2, 32)
+ utils.TryMlock(key)
+ defer clear(key)
aead, err := chacha20poly1305.New(key)
if err != nil {
return nil, fmt.Errorf("encrypt: failed to create cipher: %w", err)