Add user id parsing to PGPPacket
authorW. Trevor King <wking@tremily.us>
Fri, 20 Dec 2013 19:28:42 +0000 (11:28 -0800)
committerW. Trevor King <wking@tremily.us>
Fri, 20 Dec 2013 23:18:13 +0000 (15:18 -0800)
From RFC 4880 [1]:

  A User ID packet consists of UTF-8 text that is intended to
  represent the name and email address of the key holder.  By
  convention, it includes an RFC 2822 [RFC2822] mail name-addr, but
  there are no restrictions on its content.  The packet length in the
  header specifies the length of the User ID.

[1]: http://tools.ietf.org/search/rfc4880#section-5.11

gpg-migrate.py

index 3df89900cf352d9936fa4201dfbb4be30287fe2a..fb5ea92e8fe75c37f9cdc7e2222a8cc0ea1f5a06 100755 (executable)
@@ -395,6 +395,9 @@ class PGPPacket (dict):
         offset += 2
         self['signature'] = data[offset:]
 
+    def _parse_user_id_packet(self, data):
+        self['user'] = str(data, 'utf-8')
+
     def to_bytes(self):
         pass