Return the AES key received from the master after the minion has been successfully authenticated. :param dict payload: The incoming payload. This is a dictionary which may have the following keys: 'aes': The shared AES key 'enc': The format of the me
(self, payload, master_pub=True)
| 1618 | return False |
| 1619 | |
| 1620 | def extract_aes(self, payload, master_pub=True): |
| 1621 | """ |
| 1622 | Return the AES key received from the master after the minion has been |
| 1623 | successfully authenticated. |
| 1624 | |
| 1625 | :param dict payload: The incoming payload. This is a dictionary which may have the following keys: |
| 1626 | 'aes': The shared AES key |
| 1627 | 'enc': The format of the message. ('clear', 'pub', etc) |
| 1628 | 'publish_port': The TCP port which published the message |
| 1629 | 'token': The encrypted token used to verify the message. |
| 1630 | 'pub_key': The RSA public key of the sender. |
| 1631 | |
| 1632 | :rtype: str |
| 1633 | :return: The shared AES key received from the master. |
| 1634 | """ |
| 1635 | if master_pub: |
| 1636 | try: |
| 1637 | aes, token = self.decrypt_aes(payload, master_pub) |
| 1638 | if token != self.token: |
| 1639 | log.error("The master failed to decrypt the random minion token") |
| 1640 | return "" |
| 1641 | except Exception: # pylint: disable=broad-except |
| 1642 | log.error("The master failed to decrypt the random minion token") |
| 1643 | return "" |
| 1644 | return aes |
| 1645 | else: |
| 1646 | aes, token = self.decrypt_aes(payload, master_pub) |
| 1647 | return aes |
| 1648 | |
| 1649 | def verify_master(self, payload, master_pub=True): |
| 1650 | """ |
no test coverage detected