MCPcopy
hub / github.com/saltstack/salt / get_pub_str

Method get_pub_str

salt/crypt.py:740–762  ·  view source on GitHub ↗

Return the string representation of a public key in the pki-directory

(self)

Source from the content-addressed store, hash-verified

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 """

Callers 2

master_key_strFunction · 0.95
_auth_implMethod · 0.80

Calls 5

clean_keyFunction · 0.85
containsMethod · 0.45
public_keyMethod · 0.45
storeMethod · 0.45
fetchMethod · 0.45

Tested by

no test coverage detected