I am working on Bluetooth application. I required encrypted data transfer between two BLE device. For this purpose, I used DH for key exchange and AES for encryption/decryption.   I have doubt in parameter iv in encryption/decryption API.

Is iv need to send other side for decryption for every time?. otherwise  how to get iv in decryption part? If I sent iv with encrypted data, is it secure?


Hi Kaleb,

Thank you for your replay.
I have some  doubt regarding IV also. I am working on BLE. I need to make encrypted data transfer. I did encryption using

wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz,     
                                       const byte* iv, word32 ivSz,               
                                       byte* authTag, word32 authTagSz,           
                                       const byte* authIn, word32 authInSz)

Here i genatated IV randomly  every time.

In decryption side, IV also used for decryption.

wc_AesGcmEncrypt( aes, out,  in,  inSz, iv, ivSz,               
                              authTag, authTagSz,           
                              authIn, authInSz);

how to get IV in decryption side. is it need to  send IV with encrypted data?



I am testing encryption/decryption using AES GCM. In encryption side I took sample authentication vector and authentication tag is generated. I have following doubts.

1) can assign any size for authentication vector and authentication tag?

2) I have to decrypt data in other side , How can share authentication vector and authentication tag into other side for decryption?

3)Need to change authentication vector every time like IV?