From 9dcd30473624be5d1eedfd2cfe5ab341a4c181bf Mon Sep 17 00:00:00 2001
From: Sergey Matveev <stargrave@stargrave.org>
Date: Thu, 15 May 2025 12:48:00 +0300
Subject: [PATCH] emcenctool instead of non-PQ age

---
 README  | 11 +++++++----
 passman |  8 +++++---
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/README b/README
index 356fd49..a65bf07 100644
--- a/README
+++ b/README
@@ -1,8 +1,11 @@
 passman -- simple password manager
-It stores passwords in single recfile
-(https://www.gnu.org/software/recutils/), that is by default encrypted
-by age (https://github.com/FiloSottile/age) with the passphrase and
-compressed by zstd.
+It stores passwords in single recfile, that is encrypted either by age
+or cmenctool with the passphrase, and compressed by Zstandard.
+
+=> https://www.gnu.org/software/recutils/ recfile/recutils
+=> https://github.com/FiloSottile/age age
+=> http://www.keks.cypherpunks.su/cm/index.html cmenctool
+=> https://facebook.github.io/zstd/ Zstandard
 
 * passman add NAME [PASSWORD]
   Appends NAME credential with optional password to the database. If
diff --git a/passman b/passman
index 425f764..6d0f75e 100755
--- a/passman
+++ b/passman
@@ -18,7 +18,8 @@ DB=${PASSMANDB:-$HOME/.passmandb}
 
 dec() {
     if [ -s $DB ] ; then
-        age -d $DB | zstd -d
+        # age -d $DB | zstd -d
+        cmenctool -p -d <$DB | zstd -d
     else
         cat <<EOF
 %rec: Credential
@@ -30,7 +31,8 @@ EOF
 }
 
 enc() {
-    zstd | age -p
+    # zstd | age -p
+    zstd | cmenctool -p -embed
 }
 
 generator() {
@@ -71,7 +73,7 @@ add)
     [ -n "$dst" ]
     [ -n "$passwd" ] || passwd=$(generator)
     echo ${dst}...
-    dec | recins -t Credential -f Name -v "$dst" -f Passwd -v "$passwd" >$tmp
+    dec | recins --verbose -t Credential -f Name -v "$dst" -f Passwd -v "$passwd" >$tmp
     commit
     ;;
 mod)
-- 
2.51.0