Skip to content

Commit 3bdc079

Browse files
committed
Fix tests for Ed448 and X448 keys
GnuPG uses fingerprints for these keys that are 64 hex bytes, not 40 like for the other algorithms. Fix the tests to account for this.
1 parent 2551597 commit 3bdc079

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

splitgpg2/test_server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def generate_key(self,
171171
*,
172172
subkey_usage: str = 'encrypt',
173173
client: bool = True) -> Tuple[bytes, bytes]:
174-
fpr_re = re.compile(rb'\A[0-9A-F]{40}\Z')
174+
fpr_re = re.compile(rb'\A[0-9A-F]{40}(?:[0-9A-F]{24})?\Z')
175175
email = 'a' + str(self.counter) + self.key_uid
176176
self.counter += 1
177177
handle = base64.b64encode(os.urandom(32)).decode('ascii', 'strict')
@@ -292,6 +292,7 @@ def do_test(ty: str, subkey_ty: str, key_param: Union[str, int], subkey_param: U
292292
do_test('ECDSA', 'ECDH', 'NIST P-521', 'NIST P-521')
293293
do_test('ECDSA', 'ECDH', 'secp256k1', 'secp256k1')
294294
do_test('EDDSA', 'ECDH', 'Ed25519', 'Curve25519')
295+
do_test('EDDSA', 'ECDH', 'Ed448', 'X448')
295296

296297
for i in curves:
297298
if i.startswith('ed'):

0 commit comments

Comments
 (0)