Here is an example of converting any string value to uint8_t*. The easiest way is to simply specify the bytes of NSData as and uint8_t *. Another option is to allocate memory and copy bytes, but you still need to somehow track the length.
NSData *someData = [@"SOME STRING VALUE" dataUsingEncoding:NSUTF8StringEncoding];
const void *bytes = [someData bytes];
int length = [someData length];
uint8_t *crypto_data = (uint8_t*)bytes;
Additional way
crypto_data = malloc(length);
memcpy(crypto_data, bytes, length);
free(crypto_data);
source
share