+(defun riece-command-set-passphrase (identity passphrase)
+ "Set PASSPHRASE associated with IDENTITY."
+ (interactive
+ (let ((identity
+ (riece-completing-read-identity
+ "Channel/user: "
+ riece-current-channels nil t nil nil
+ (riece-format-identity riece-current-channel))))
+ (list identity
+ (read-passwd (format "Passphrase for %s: "
+ (riece-format-identity identity))))))
+ (let ((entry (riece-identity-assoc identity riece-epg-passphrase-alist)))
+ (if (equal passphrase "")
+ (if entry
+ (setq riece-epg-passphrase-alist
+ (delq entry riece-epg-passphrase-alist)))
+ (if entry
+ (setcdr entry passphrase)
+ (setq riece-epg-passphrase-alist
+ (cons (cons identity passphrase)
+ riece-epg-passphrase-alist))))))
+
+(defun riece-epg-decrypt-string-for-identity (context cipher target)
+ (let ((coding-system
+ (or (riece-coding-system-for-identity target)
+ riece-default-coding-system)))
+ (riece-with-server-buffer (riece-identity-server target)
+ (decode-coding-string
+ (riece-epg-funcall-clear-passphrase
+ target
+ #'epg-decrypt-string
+ context
+ (base64-decode-string cipher))
+ (if (consp coding-system)
+ (car coding-system)
+ coding-system)))))
+