Any shortcut to generate a 16 byte random data as Initialisation Vector for AES128 CBC method?

ios, objective-c

Solution

You can use `SecRandomCopyBytes` from Security framework.

This function reads from `/dev/random` to obtain an array of cryptographically-secure random bytes.

uint8_t vector[16];
SecRandomCopyBytes(kSecRandomDefault, 16, vector);

Problem

Is there any easy way to generate this kind random data or string? Like an existing function?

Original source