update.
[elisp/semi.git] / pgg-parse.el
index 910b0ff..f4fa7e8 100644 (file)
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
 ;;    This module is based on
 
+;;     [OpenPGP] RFC 4880: "OpenPGP Message Format"
+;;         by Derek Atkins <derek@ihtfp.com>,
+;;          Jon Callas <jon@callas.org>, Lutz Donnerhacke <lutz@iks-jena.de>,
+;;          Hal Finney <hal@finney.org>, David Shaw <dshaw@jabberwocky.com>
+;;          and Rodney Thayer <rodney@canola-jones.com>
+;;         (2007/11)
+;;
 ;;     [OpenPGP] RFC 2440: "OpenPGP Message Format"
 ;;         by John W. Noerenberg, II <jwn2@qualcomm.com>,
 ;;          Jon Callas <jon@pgp.com>, Lutz Donnerhacke <lutz@iks-jena.de>,
@@ -39,9 +46,8 @@
 
 (eval-when-compile (require 'static))
 
-(require 'poem)
 (require 'pccl)
-(require 'pcustom)
+(require 'custom)
 (require 'mel)
 
 (defgroup pgg-parse ()
   :type 'alist)
 
 (defcustom pgg-parse-symmetric-key-algorithm-alist
-  '((1 . IDEA) (2 . 3DES) (4 . CAST5) (5 . SAFER-SK128))
+  '((1 . IDEA) (2 . 3DES) (3 . CAST5) (4 . BLOWFISH) (5 . SAFER-SK128)
+    (7 . AES) (8 . AES192) (9. AES256) (10 . TWOFISH))
   "Alist of the assigned number to the simmetric key algorithm."
   :group 'pgg-parse
   :type 'alist)
 
 (defcustom pgg-parse-hash-algorithm-alist
-  '((1 . MD5) (2 . SHA1) (3 . RIPEMD160) (5 . MD2))
+  '((1 . MD5) (2 . SHA1) (3 . RIPEMD160) (5 . MD2)
+    (8 . SHA256) (9 . SHA384) (10 . SHA512) (11 . SHA224))
   "Alist of the assigned number to the cryptographic hash algorithm."
   :group 'pgg-parse
   :type 'alist)
@@ -69,7 +77,8 @@
 (defcustom pgg-parse-compression-algorithm-alist
   '((0 . nil); Uncompressed
     (1 . ZIP)
-    (2 . ZLIB))
+    (2 . ZLIB)
+    (3 . BZip2))
   "Alist of the assigned number to the compression algorithm."
   :group 'pgg-parse
   :type 'alist)
     (18 . "Casual certification of a User ID and Public Key packet")
     (19 . "Positive certification of a User ID and Public Key packet")
     (24 . "Subkey Binding Signature")
+    (25 . "Primary Key Binding Signature")
     (31 . "Signature directly on a key")
     (32 . "Key revocation signature")
     (40 . "Subkey revocation signature")
     (48 . "Certification revocation signature")
-    (64 . "Timestamp signature."))
+    (64 . "Timestamp signature")
+    (80 . "Third-Party Confirmation signature"))
   "Alist of the assigned number to the signature type."
   :group 'pgg-parse
   :type 'alist)
   "Armor headers.")
 
 (defmacro pgg-format-key-identifier (string)
-  `(upcase (apply #'format "%02x%02x%02x%02x%02x%02x%02x%02x"
-                 (string-to-int-list ,string))))
+  `(mapconcat (lambda (c) (format "%02X" (char-int c)))
+             ,string "")
+  ;; `(upcase (apply #'format "%02x%02x%02x%02x%02x%02x%02x%02x"
+  ;;                 (string-to-int-list ,string)))
+  )
 
 (defmacro pgg-parse-time-field (bytes)
   `(list (logior (lsh (car ,bytes) 8)
              (forward-char ,nbytes))))
 
 (defmacro pgg-read-bytes (nbytes)
-  `(string-to-int-list (pgg-read-bytes-string ,nbytes)))
+  `(mapcar #'char-int (pgg-read-bytes-string ,nbytes))
+  ;; `(string-to-int-list (pgg-read-bytes-string ,nbytes))
+  )
 
 (defmacro pgg-read-body-string (ptag)
   `(if (nth 1 ,ptag)
      (pgg-read-bytes-string (- (point-max) (point)))))
 
 (defmacro pgg-read-body (ptag)
-  `(string-to-int-list (pgg-read-body-string ,ptag)))
+  `(mapcar #'char-int (pgg-read-body-string ,ptag))
+  ;; `(string-to-int-list (pgg-read-body-string ,ptag))
+  )
 
 (defalias 'pgg-skip-bytes 'forward-char)