|
40 | 40 |
|
41 | 41 | from securesystemslib import process |
42 | 42 | from securesystemslib.gpg.functions import (create_signature, export_pubkey, |
43 | | - verify_signature) |
| 43 | + verify_signature, export_pubkeys) |
44 | 44 | from securesystemslib.gpg.util import (get_version, is_version_fully_supported, |
45 | 45 | get_hashing_class, parse_packet_header, parse_subpacket_header) |
46 | 46 | from securesystemslib.gpg.rsa import create_pubkey as rsa_create_pubkey |
|
55 | 55 | from securesystemslib.gpg.exceptions import (PacketParsingError, |
56 | 56 | PacketVersionNotSupportedError, SignatureAlgorithmNotSupportedError, |
57 | 57 | KeyNotFoundError, CommandError, KeyExpirationError) |
58 | | -from securesystemslib.formats import GPG_PUBKEY_SCHEMA |
| 58 | +from securesystemslib.formats import (GPG_PUBKEY_SCHEMA, |
| 59 | + ANY_PUBKEY_DICT_SCHEMA) |
59 | 60 |
|
60 | 61 |
|
61 | 62 | @unittest.skipIf(not HAVE_GPG, "gpg not found") |
@@ -481,6 +482,8 @@ class TestGPGRSA(unittest.TestCase): |
481 | 482 | unsupported_subkey_keyid = "611A9B648E16F54E8A7FAD5DA51E8CDF3B06524F" |
482 | 483 | expired_key_keyid = "E8AC80C924116DABB51D4B987CB07D6D2C199C7C" |
483 | 484 |
|
| 485 | + keyid_768C43 = "7B3ABB26B97B655AB9296BD15B0BD02E1C768C43" |
| 486 | + |
484 | 487 | @classmethod |
485 | 488 | def setUpClass(self): |
486 | 489 | # Create directory to run the tests without having everything blow up |
@@ -547,6 +550,17 @@ def test_export_pubkey(self): |
547 | 550 | self.assertDictEqual(key_data, key_data2) |
548 | 551 |
|
549 | 552 |
|
| 553 | + def test_export_pubkeys(self): |
| 554 | + """Test export multiple pubkeys at once. """ |
| 555 | + key_dict = export_pubkeys([self.default_keyid, self.keyid_768C43], |
| 556 | + homedir=self.gnupg_home) |
| 557 | + |
| 558 | + ANY_PUBKEY_DICT_SCHEMA.check_match(key_dict) |
| 559 | + self.assertListEqual( |
| 560 | + sorted([self.default_keyid.lower(), self.keyid_768C43.lower()]), |
| 561 | + sorted(key_dict.keys())) |
| 562 | + |
| 563 | + |
550 | 564 | def test_gpg_sign_and_verify_object_with_default_key(self): |
551 | 565 | """Create a signature using the default key on the keyring """ |
552 | 566 |
|
|
0 commit comments