Return the fingerprint for a specified key
(self, match, hash_type=None)
| 914 | return self.list_keys() |
| 915 | |
| 916 | def finger(self, match, hash_type=None): |
| 917 | """ |
| 918 | Return the fingerprint for a specified key |
| 919 | """ |
| 920 | if hash_type is None: |
| 921 | hash_type = self.opts["hash_type"] |
| 922 | |
| 923 | matches = self.glob_match(match, full=True) |
| 924 | ret = {} |
| 925 | for status, keys in matches.items(): |
| 926 | ret[status] = {} |
| 927 | for key in keys: |
| 928 | if status == "minions_denied": |
| 929 | denied = self.cache.fetch("denied_keys", key) |
| 930 | for den in denied: |
| 931 | finger = salt.utils.crypt.pem_finger( |
| 932 | key=den.encode("utf-8"), sum_type=hash_type |
| 933 | ) |
| 934 | ret[status].setdefault(key, []).append(finger) |
| 935 | # brush over some dumb backcompat with how denied keys work |
| 936 | # with the legacy system |
| 937 | if len(denied) == 1: |
| 938 | ret[status][key] = ret[status][key][0] |
| 939 | else: |
| 940 | if status == "local": |
| 941 | pub = self.cache.fetch("master_keys", key).encode("utf-8") |
| 942 | else: |
| 943 | pub = self.cache.fetch("keys", key)["pub"].encode("utf-8") |
| 944 | ret[status][key] = salt.utils.crypt.pem_finger( |
| 945 | key=pub, sum_type=hash_type |
| 946 | ) |
| 947 | return ret |
| 948 | |
| 949 | def finger_all(self, hash_type=None): |
| 950 | """ |