gpg: allow longer packets

This commit is contained in:
Roman Zeyde
2016-04-30 14:47:32 +03:00
parent 5c04d17c43
commit c3d23ea7f5

View File

@@ -13,11 +13,9 @@ log = logging.getLogger(__name__)
def packet(tag, blob):
"""Create small GPG packet."""
# TODO: allow larger sizes.
assert len(blob) < 256
length_type = 0 # : 1 byte for length
length_type = 1 # : 2 bytes for length
leading_byte = 0x80 | (tag << 2) | (length_type)
return struct.pack('>B', leading_byte) + util.prefix_len('>B', blob)
return struct.pack('>B', leading_byte) + util.prefix_len('>H', blob)
def subpacket(subpacket_type, fmt, *values):