gpg: add compression and stronger digests
This commit is contained in:
@@ -23,9 +23,9 @@ def create_primary(user_id, pubkey, signer_func, secret_bytes=b''):
|
|||||||
# https://tools.ietf.org/html/rfc4880#section-5.2.3.4
|
# https://tools.ietf.org/html/rfc4880#section-5.2.3.4
|
||||||
protocol.subpacket_byte(0x1B, 1 | 2), # key flags (certify & sign)
|
protocol.subpacket_byte(0x1B, 1 | 2), # key flags (certify & sign)
|
||||||
# https://tools.ietf.org/html/rfc4880#section-5.2.3.21
|
# https://tools.ietf.org/html/rfc4880#section-5.2.3.21
|
||||||
protocol.subpacket_byte(0x15, 8), # preferred hash (SHA256)
|
protocol.subpacket_bytes(0x15, [8, 9, 10]), # preferred hash
|
||||||
# https://tools.ietf.org/html/rfc4880#section-5.2.3.8
|
# https://tools.ietf.org/html/rfc4880#section-5.2.3.8
|
||||||
protocol.subpacket_byte(0x16, 0), # preferred compression (none)
|
protocol.subpacket_bytes(0x16, [2, 3, 1]), # preferred compression
|
||||||
# https://tools.ietf.org/html/rfc4880#section-5.2.3.9
|
# https://tools.ietf.org/html/rfc4880#section-5.2.3.9
|
||||||
protocol.subpacket_byte(0x17, 0x80) # key server prefs (no-modify)
|
protocol.subpacket_byte(0x17, 0x80) # key server prefs (no-modify)
|
||||||
# https://tools.ietf.org/html/rfc4880#section-5.2.3.17
|
# https://tools.ietf.org/html/rfc4880#section-5.2.3.17
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ def subpacket_byte(subpacket_type, value):
|
|||||||
return subpacket(subpacket_type, '>B', value)
|
return subpacket(subpacket_type, '>B', value)
|
||||||
|
|
||||||
|
|
||||||
|
def subpacket_bytes(subpacket_type, values):
|
||||||
|
"""Create GPG subpacket with 8-bit unsigned integers."""
|
||||||
|
return subpacket(subpacket_type, '>' + 'B'*len(values), *values)
|
||||||
|
|
||||||
|
|
||||||
def subpacket_prefix_len(item):
|
def subpacket_prefix_len(item):
|
||||||
"""Prefix subpacket length according to RFC 4880 section-5.2.3.1."""
|
"""Prefix subpacket length according to RFC 4880 section-5.2.3.1."""
|
||||||
n = len(item)
|
n = len(item)
|
||||||
|
|||||||
Reference in New Issue
Block a user