def encrypt_template(self, enc_key, mac_key, enc_offset):
        """
        Encrypts current tpl_buf according to the protocol - symmetric encryption
        :param enc_key:
        :param mac_key:
        :param enc_offset:
        :return:
        """

        # AES-256-CBC/PKCS7Padding
        to_encrypt = self.tpl_buff[enc_offset:]
        encrypted = aes_enc(enc_key, PKCS7.pad(to_encrypt))

        # Mac the whole buffer
        to_mac = PKCS7.pad(self.tpl_buff[:enc_offset] + encrypted)
        mac = cbc_mac(mac_key, to_mac)

        return to_mac + mac