2006-04-13 Daiki Ueno <ueno@unixuser.org>
+ * epg.el (epg-cipher-algorithm-alist): New constant.
+ (epg-pubkey-algorithm-alist): New constant.
+ (epg-digest-algorithm-alist): New constant.
+ (epg-compress-algorithm-alist): New constant.
+ (epg-configuration): New function.
+
+2006-04-13 Daiki Ueno <ueno@unixuser.org>
+
* epg.el (epg-make-data-from-file): New function.
(epg-make-data-from-string): New function.
(epg-data-file): New function.
"The schema of keylisting output whose type is \"uid\".
This is used by `epg-list-keys'.")
+(defconst epg-cipher-algorithm-alist
+ '((0 . "NONE")
+ (1 . "IDEA")
+ (2 . "3DES")
+ (3 . "CAST5")
+ (4 . "BLOWFISH")
+ (7 . "AES")
+ (8 . "AES192")
+ (9 . "AES256")
+ (10 . "TWOFISH")
+ (110 . "DUMMY")))
+
+(defconst epg-pubkey-algorithm-alist
+ '((1 . "RSA")
+ (2 . "RSA_E")
+ (3 . "RSA_S")
+ (16 . "ELGAMAL_E")
+ (17 . "DSA")
+ (20 . "ELGAMAL")))
+
+(defconst epg-digest-algorithm-alist
+ '((1 . "MD5")
+ (2 . "SHA1")
+ (3 . "RMD160")
+ (8 . "SHA256")
+ (9 . "SHA384")
+ (10 . "SHA512")))
+
+(defconst epg-compress-algorithm-alist
+ '((0 . "NONE")
+ (1 . "ZIP")
+ (2 . "ZLIB")
+ (3 . "BZIP2")))
+
(defvar epg-prompt-alist nil)
(defun epg-make-data-from-file (file)
(defun epg-progress-callback-function (what char current total handback)
(message "%s: %d%%/%d%%" what current total))
+(defun epg-configuration ()
+ "Return a list of internal configuration parameters of `epg-gpg-program'."
+ (let (configuration type)
+ (with-temp-buffer
+ (apply #'call-process epg-gpg-program nil (list t nil) nil
+ '("--with-colons" "--list-config"))
+ (goto-char (point-min))
+ (while (re-search-forward "^cfg:\\([^:]+\\):\\(.*\\)" nil t)
+ (setq type (intern (match-string 1))
+ config (cons (cons type
+ (if (memq type
+ '(pubkey cipher digest compress))
+ (mapcar #'string-to-number
+ (delete "" (split-string
+ (match-string 2)
+ ";")))
+ (match-string 2)))
+ config))))
+ config))
+
(defun epg-list-keys (name &optional secret)
"List keys associated with STRING."
(let ((args (list "--with-colons" "--no-greeting" "--batch"
(with-temp-buffer
(apply #'call-process epg-gpg-program nil (list t nil) nil args)
(goto-char (point-min))
- (while (looking-at "\\([a-z][a-z][a-z]\\):\\(.*\\)")
+ (while (re-search-forward "^\\([a-z][a-z][a-z]\\):\\(.*\\)" nil t)
(setq type (match-string 1)
symbol (intern-soft (format "epg-colons-%s-spec" type)))
(if (member type '("pub" "sec"))