docs: def encrypt(self, text, app_id):
          """
          对明文进行加密
          :param text: 需要加密的明文
          :param app_id: 微信公众平台的 AppID
          :return: 加密后的字符串
          """
          text = b"".join(
              [
                  to_binary(self.get_random_string()),
                  struct.pack(b"I", socket.htonl(len(to_binary(text)))),
                  to_binary(text),
                  to_binary(app_id)
              ]
          )
          text = pkcs7.encode(text)
          encryptor = self.cipher.encryptor()
          ciphertext = to_binary(encryptor.update(text) + encryptor.finalize())
          return base64.b64encode(ciphertext)