Thanks Alex! That was a nice cue.
In my viprc I've ended up with the code below.
I can now define one or more named keys and use them to encrypt/decrypt
buffers in a given session without showing the key
Regards,
Lindsay
(setq *EncKeys '(("yek" . "key")))
(cmd "yek" (L Lst Cnt) # Set named encryption key
(let (P1 NIL P2 NIL
GetPwd '(() (pack (make
(use C
(until (sub? (setq C (getch)) "\r\n")
(link C)) ) ) ) )
)
(when L
(prCmd (make (link (chop (pack "Setting encryption key for [" L
"]")))))
(prCmd (make (link (chop "Enter Password:"))))
(setq P1 (GetPwd))
(prCmd (make (link (chop "Confirm Password:"))))
(setq P2 (GetPwd))
(ifn (= P1 P2)
(prCmd (list (chop "Encryption key NOT set; Password
mismatch")))
(if (assoc L *EncKeys)
(con @ P1)
(push '*EncKeys (cons L P1))
)
(prCmd (list (chop "Encryption key set")))
) ) ) )
(cmd "enc" (L Lst Cnt) # Encrypt buffer using named key
(when (sys "YEK" (cdr (assoc L *EncKeys)) )
...
(cmd "dec" (L Lst Cnt) # Encrypt buffer using named key
(when (sys "YEK" (cdr (assoc L *EncKeys)) )
...