Archived Forum Post

Index of archived forum posts


AES - How to share secret key between android and iOS

Jun 06 '14 at 08:50

We referred this link to encrypt a file using AES algo:

Here hardcoded keyHex and ivHex are used to encrypt a file.

Now I have couple of related questions

  1. Is there any method to generate random keyHex and ivHex in chilkat library? Basically each time we want a unique keyHex and ivHex pair to be used to encrypt-decrypt a file.
  2. How shall we share the generated keyHex and ivHex pair to android device and vice-versa? We are planning to share it to other user after encrypting it with his public key (RSA algo)? Do we need to first encrypt keyHex and then ivHex using public key and share both across?


The GenRandomBytesENC method can be called to generate N random bytes and return them as an encoded string (using Base64, hex, etc.)

A typical way of having a shared secret (i.e. a shared symmetric key where only the two parties know the key) is via RSA. See this: