KeyServerPreferences is a bitfield, not a list

Key Server Preferences (RFC 4880 §5.2.3.17) is a bitfield, more like
Key Flags (RFC 4880 §5.2.3.21) than Preferred Hash Algorithms (RFC
4880 §5.2.3.8).

The caller should be able to invoke this as a set when calling
PGPKey.certify().

This patch also improves documentation for PGPKey.certify() to
indicate how to pass in these flags.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
This commit is contained in:
Daniel Kahn Gillmor
2019-08-27 16:18:39 -04:00
parent 21cbf0d006
commit 6d7877d167
4 changed files with 6 additions and 5 deletions

View File

@@ -335,7 +335,7 @@ class TestPGPKey_Management(object):
hashes=[HashAlgorithm.SHA384],
compression=[CompressionAlgorithm.ZLIB],
key_expiration=expiration,
keyserver_flags=0x80,
keyserver_flags={KeyServerPreferences.NoModify},
keyserver='about:none',
primary=False)
@@ -348,7 +348,7 @@ class TestPGPKey_Management(object):
assert sig.features == {Features.ModificationDetection}
assert sig.key_expiration == expiration - key.created
assert sig.keyserver == 'about:none'
assert sig.keyserverprefs == [KeyServerPreferences.NoModify]
assert sig.keyserverprefs == {KeyServerPreferences.NoModify}
assert uid.is_primary is False