I am trying to create a string message and then encrypt it via AES but the example only accepts byte array as input. How can I convert fullmessage string to message byte array to encrypt it? Checked similar questions but couldn't resolve the problem.
void loop ()
{
dt = clock.getDateTime();
String dash = "-";
String comma = ",";
String time = dt.year + dash + dt.month + dash + dt.day + dash + dt.hour + dash + dt.minute + dash + dt.second;
String status = "OK";
String fullmessage = time + comma + status;
byte message[]= "anything";
plainLength = sizeof(message)-1;
padedLength = plainLength + N_BLOCK - plainLength % N_BLOCK;
prekey(256,message);
delay(2000);
}
strcpy(message, fullMessage.c_str());allocate message aschar message[MESSAGE_SIZE];https://www.tutorialspoint.com/c_standard_library/string_h.htm – Juraj Jan 03 '20 at 08:50