data encryption

Trialblazer47
Posts: 42
Joined: Mon Jun 26, 2017 5:36 am

data encryption

Postby Trialblazer47 » Wed Nov 01, 2017 12:55 pm

I wanted to encrypt data to be sent over ble. I am trying to reuse the security file provided with blufi example.

I think the two API blufi_aes_encrypt & blufi_aes_decrypt are to be used to encrypt and decrypt. I tried to make a test code.

first I initalized

Code: Select all

void app_main()
{
  char *input="hello";
  char *out;
  if( security_init() == ESP_FAIL  )
    {
      ESP_LOGI(TAG,"Security init failed.\n");
    }
ESP_LOGI(TAG,"Security done.\n");
aes_encrypt(10, input,5);                       <---- but this keeps crashing  I don't understand its input.
ESP_LOGI(TAG,"Encrypted : %s \n",input);
}



I am also thinking where the encryption key set?

I want simple way to encrypt and decrypt data. so please any example would be helpful.
Thanks.

blekyo
Posts: 10
Joined: Tue Nov 14, 2017 2:15 am

Re: data encryption

Postby blekyo » Mon Nov 27, 2017 9:14 am

Hi,
I'm getting the same issue you. Did you you find out how to make it work?

Trialblazer47
Posts: 42
Joined: Mon Jun 26, 2017 5:36 am

Re: data encryption

Postby Trialblazer47 » Tue Dec 05, 2017 1:32 pm

no than I gave up that idea.
Thanks.

chegewara
Posts: 96
Joined: Wed Jun 14, 2017 9:00 pm

Re: data encryption

Postby chegewara » Tue Dec 12, 2017 9:41 pm

I dont know why this is not answered yet, since its a simple answer. This is wrong usage:

Code: Select all

aes_encrypt(10, input,5);

Check this https://github.com/espressif/esp-idf/bl ... /aes.h#L21
and this https://github.com/espressif/esp-idf/bl ... .h#L49-L52

and you will have answers why it crash and where to set encryption key.

blekyo
Posts: 10
Joined: Tue Nov 14, 2017 2:15 am

Re: data encryption

Postby blekyo » Fri Dec 15, 2017 3:27 am

OK thanks, after a time spent looking on the code, I managed to understand how to use the mbedtls aes encryption/decryption

Who is online

Users browsing this forum: No registered users and 8 guests