Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

output in microcontroller #4

Open
andreddosantos opened this issue Nov 13, 2018 · 3 comments
Open

output in microcontroller #4

andreddosantos opened this issue Nov 13, 2018 · 3 comments

Comments

@andreddosantos
Copy link

andreddosantos commented Nov 13, 2018

Hello,

when applying your c library in a microcontroller i'm having the following output as response.

message: {"data":{"m" : "test message"}}
used crypto key: "8b78b1c92031cb91"
output -> " +esAGq7 +4lAEE3 5i5 65NABSJADOv 8iI 7T3AGB6 7dX"

    String plain_text = String("{\"data\":" + payload + "}");

    size_t len;
    unsigned char *encrypt_data = xxtea_encrypt((char*) plain_text.c_str(), strlen(plain_text.c_str()), _key, &len);
    char * encryptedPayload = base64_encode(encrypt_data, len);

    Serial.println("Payload base64: " + String(encryptedPayload));

is this the right output? what am i doing wrong?

Regards
André

@andot
Copy link
Member

andot commented Nov 14, 2018

the output is right when you can decrypt the encrypt_data.

@andreddosantos
Copy link
Author

I don't think base64 predicts whitespace chars... That output is not right.

I want to send that base64 string to a server where the message will be decrypted, but i'm not being able to send since it does not encrypt.

I'm stuck now...

@andot
Copy link
Member

andot commented Nov 15, 2018

Maybe your base64 library has some problem.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants