This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes


I'm working on a small game with a highscore list on a server. I'v used godots Crypto class to do the rsa encrpytion, but unfortunately it's not supported for html exports in 3.5.1. I now switched everything to c# RSACryptoServiceProvider. It works fine in the engine, but in the html export it spams

at: flush (core/message_queue.cpp:257) - Condition "flushing" is true. tmp_js_export.js:369:18

over and over again.

Does anybody know what it's caused by or can recommend me another RSA library?

thank you very much.

Here are the relevent parts of the code:

public void writeToplist(string data) {

        RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
        File publicKeyFile = new File();
        publicKeyFile.Open("res://content/keys/convertedPublic.xml", File.ModeFlags.Read);
        byte[] encrypted = rsa.Encrypt(Encoding.UTF8.GetBytes(data), false);

        writeRequestCompleted = false;
        HTTPRequest request = new HTTPRequest();
        request.Connect("request_completed", this, "OnWriteRequestCompleted");
        request.Request(wUrl, null, true, HTTPClient.Method.Post, Convert.ToBase64String(encrypted));
        GD.Print("toplist written");

    public void readToplist() {
        answer = null;
        HTTPRequest request = new HTTPRequest();
        request.Connect("request_completed", this, "OnReadRequestCompleted");

    private void OnReadRequestCompleted(long result, long responseCode, string[] headers, byte[] body)
        if (result != (int)HTTPRequest.Result.Success)
            GD.Print("HTTP request failed");
            answer = "Data not found.";

        answer = Encoding.UTF8.GetString(body);    

        RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
        File privateKeyFile = new File();
        privateKeyFile.Open("content/keys/convertedPrivate.xml", File.ModeFlags.Read);
        byte[] decrypted = rsa.Decrypt(Convert.FromBase64String(answer), false);

        answer = Encoding.UTF8.GetString(decrypted);

Godot version 3.5.1
in Engine by (95 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.