Return the string representation of a public key in the pki-directory
(self)
| 738 | raise MasterExit(message) |
| 739 | |
| 740 | def get_pub_str(self): |
| 741 | """ |
| 742 | Return the string representation of a public key |
| 743 | in the pki-directory |
| 744 | """ |
| 745 | if self.opts["cluster_id"]: |
| 746 | key = "cluster.pub" |
| 747 | else: |
| 748 | key = f"{self.master_id}.pub" |
| 749 | |
| 750 | # XXX We should always have a key present when this is called, if not |
| 751 | # it's an error. |
| 752 | # if not os.path.isfile(path): |
| 753 | # raise RuntimeError(f"The key {path} does not exist.") |
| 754 | if not self.cache.contains("master_keys", key): |
| 755 | pubkey = self.key.public_key() |
| 756 | key_bytes = pubkey.public_bytes( |
| 757 | encoding=serialization.Encoding.PEM, |
| 758 | format=serialization.PublicFormat.SubjectPublicKeyInfo, |
| 759 | ) |
| 760 | self.cache.store("master_keys", key, key_bytes) |
| 761 | |
| 762 | return clean_key(self.cache.fetch("master_keys", key)) |
| 763 | |
| 764 | def check_master_shared_pub(self): |
| 765 | """ |
no test coverage detected