I'm following Apple's sample code on RSA. I've got everything working, and now I'm trying to replace the string literal they use with a dynamically allocated string (from my textview).  

Apple's code is: 

```
const uint8_t dataToEncrypt[] = "the quick brown fox jumps "
                        "over the lazy dog\0"; 

```

I need to be able to set this dynamically, but I'm unsure how to do it because when I try I get the following error: "Array initializer must be an initializer list or string literal"

```
 static const UInt8 publicKeyIdentifier[] = "com.apple.sample.publickey\0";
static const UInt8 privateKeyIdentifier[] = "com.apple.sample.privatekey\0";
- (IBAction)encrypt:(id)sender {
NSString *privateKey = [[NSUserDefaults standardUserDefaults]
                        stringForKey:@"privateKey"];

OSStatus status = noErr;

size_t cipherBufferSize;
uint8_t *cipherBuffer;                     // 1

// [cipherBufferSize]
///////////////////
NSString *textToEncode = [NSString stringWithFormat:@"%@%@", self.textView.text, @"\0"];
//////////////////////
const uint8_t dataToEncrypt[] = textToEncode;//This throws the error
//"the quick brown fox jumps over the lazy dog\0"; // 2

size_t dataLength = sizeof(dataToEncrypt)/sizeof(dataToEncrypt[0]);

SecKeyRef publicKey = NULL;                                 // 3

NSData * publicTag = [NSData dataWithBytes:publicKeyIdentifier
                                    length:strlen((const char *)publicKeyIdentifier)]; // 4

NSMutableDictionary *queryPublicKey =
[[NSMutableDictionary alloc] init]; // 5

[queryPublicKey setObject:(__bridge id)kSecClassKey forKey:(__bridge id)kSecClass];
[queryPublicKey setObject:publicTag forKey:(__bridge id)kSecAttrApplicationTag];
[queryPublicKey setObject:(__bridge id)kSecAttrKeyTypeRSA forKey:(__bridge id)kSecAttrKeyType];
[queryPublicKey setObject:[NSNumber numberWithBool:YES] forKey:(__bridge id)kSecReturnRef];
// 6

status = SecItemCopyMatching
((__bridge CFDictionaryRef)queryPublicKey, (CFTypeRef *)&publicKey); // 7

//  Allocate a buffer

cipherBufferSize = SecKeyGetBlockSize(publicKey);
cipherBuffer = malloc(cipherBufferSize);

//  Error handling

if (cipherBufferSize < sizeof(dataToEncrypt)) {
    // Ordinarily, you would split the data up into blocks
    // equal to cipherBufferSize, with the last block being
    // shorter. For simplicity, this example assumes that
    // the data is short enough to fit.
    printf("Could not decrypt.  Packet too large.\n");
}

// Encrypt using the public.
status = SecKeyEncrypt(    publicKey,
                       kSecPaddingPKCS1,
                       dataToEncrypt,
                       (size_t) dataLength,
                       cipherBuffer,
                       &cipherBufferSize
                       );                              // 8

//  Error handling
//  Store or transmit the encrypted text

if (publicKey) CFRelease(publicKey);

//NSData *encryptedData = [NSData dataWithBytes:cipherBuffer length:dataLength];
NSData *encryptedData = [NSData dataWithBytes:cipherBuffer length:cipherBufferSize];

free(cipherBuffer);
self.textView.text = [NSString stringWithFormat:@"%@",encryptedData];

}

```

EDIT: 

Replace: 

```
  const uint8_t dataToEncrypt[]

```

With:

```
  NSData *someData = [self.textView.text dataUsingEncoding:NSUTF8StringEncoding];
  const void *bytes = [someData bytes];
  const uint8_t *dataToEncrypt = (uint8_t*)bytes;

```