summaryrefslogtreecommitdiffstats
path: root/ffi/lang
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-04-29 14:36:24 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-04-29 14:55:52 +0200
commitb3b18a2a9e370b226cdc3015616e072d22937ddf (patch)
treeaddde6ca6e51fb788dd0c7bbdb5d6beeddd3d66d /ffi/lang
parent36ed0f847c4f033c67fca9f2a332598b5effc107 (diff)
openpgp-ffi: Introduce a new Packet type.
- See #156.
Diffstat (limited to 'ffi/lang')
-rw-r--r--ffi/lang/python/sequoia/openpgp.py21
-rw-r--r--ffi/lang/python/sequoia/sequoia_build.py1
2 files changed, 13 insertions, 9 deletions
diff --git a/ffi/lang/python/sequoia/openpgp.py b/ffi/lang/python/sequoia/openpgp.py
index de567c09..ddd76dbe 100644
--- a/ffi/lang/python/sequoia/openpgp.py
+++ b/ffi/lang/python/sequoia/openpgp.py
@@ -235,22 +235,25 @@ class SEIP(SQObject):
class Packet(SQObject):
_map = {
- Tag.PublicKey: lambda x, **kwargs: PublicKey(x.key, **kwargs),
- Tag.PublicSubkey: lambda x, **kwargs: PublicSubkey(x.key, **kwargs),
- Tag.SecretKey: lambda x, **kwargs: SecretKey(x.key, **kwargs),
- Tag.SecretSubkey: lambda x, **kwargs: SecretSubkey(x.key, **kwargs),
- Tag.UserID: lambda x, **kwargs: UserID(x.user_id, **kwargs),
- Tag.UserAttribute: lambda x, **kwargs: UserAttribute(x.user_attribute, **kwargs),
- Tag.SKESK: lambda x, **kwargs: SKESK(x.skesk, **kwargs),
- Tag.SEIP: lambda x, **kwargs: SEIP(x.seip, **kwargs),
+ Tag.PublicKey: lambda x, **kwargs: PublicKey(x, **kwargs),
+ Tag.PublicSubkey: lambda x, **kwargs: PublicSubkey(x, **kwargs),
+ Tag.SecretKey: lambda x, **kwargs: SecretKey(x, **kwargs),
+ Tag.SecretSubkey: lambda x, **kwargs: SecretSubkey(x, **kwargs),
+ Tag.UserID: lambda x, **kwargs: UserID(x, **kwargs),
+ Tag.UserAttribute: lambda x, **kwargs: UserAttribute(x, **kwargs),
+ Tag.SKESK: lambda x, **kwargs: SKESK(x, **kwargs),
+ Tag.SEIP: lambda x, **kwargs: SEIP(x, **kwargs),
}
@property
def tag(self):
return Tag(lib.pgp_packet_tag(self.ref()))
+ @property
+ def kind(self):
+ return Tag(lib.pgp_packet_kind(self.ref()))
def __str__(self):
return "<Packet tag={}>".format(self.tag)
def match(self):
- return self._map[self.tag](self.ref(), context=self.context(), owner=self)
+ return self._map[self.kind](self.ref(), context=self.context(), owner=self)
class PacketParserResult(SQObject):
_del = lib.pgp_packet_parser_result_free
diff --git a/ffi/lang/python/sequoia/sequoia_build.py b/ffi/lang/python/sequoia/sequoia_build.py
index 9fe6343a..5243e489 100644
--- a/ffi/lang/python/sequoia/sequoia_build.py
+++ b/ffi/lang/python/sequoia/sequoia_build.py
@@ -10,6 +10,7 @@ defs = "".join(l
open(join(pgp_inc, "io.h")).readlines(),
open(join(pgp_inc, "openpgp/types.h")).readlines(),
open(join(pgp_inc, "openpgp/crypto.h")).readlines(),
+ open(join(pgp_inc, "openpgp/packet.h")).readlines(),
open(join(pgp_inc, "openpgp.h")).readlines(),
open(join(sq_inc, "core.h")).readlines(),
open(join(sq_inc, "net.h")).readlines(),