Generates the payload used to authenticate with the master
        server. This payload consists of the passed in id_ and the ssh
        public key to encrypt the AES key sent back from the master.

        :return: Payload dictionary
        :rtype: dict

def minion_sign_in_payload(self):
        '''
        Generates the payload used to authenticate with the master
        server. This payload consists of the passed in id_ and the ssh
        public key to encrypt the AES key sent back from the master.

        :return: Payload dictionary
        :rtype: dict
        '''
        payload = {}
        payload['cmd'] = '_auth'
        payload['id'] = self.opts['id']
        if 'autosign_grains' in self.opts:
            autosign_grains = {}
            for grain in self.opts['autosign_grains']:
                autosign_grains[grain] = self.opts['grains'].get(grain, None)
            payload['autosign_grains'] = autosign_grains
        try:
            pubkey_path = os.path.join(self.opts['pki_dir'], self.mpub)
            pub = get_rsa_pub_key(pubkey_path)
            if HAS_M2:
                payload['token'] = pub.public_encrypt(self.token, RSA.pkcs1_oaep_padding)
            else:
                cipher = PKCS1_OAEP.new(pub)
                payload['token'] = cipher.encrypt(self.token)
        except Exception:
            pass
        with salt.utils.files.fopen(self.pub_path) as f:
            payload['pub'] = f.read()
        return payload