0
votes

i have some problem to decrypted a file, which was encrypted using a C# AES256 implementation with an IV (in vector) as an 16bit byte-array and 32bit byte-array for the key. For decryption i used Apple's CommonCryptor CCCrypt, but my key is an NSString. So how can i convert the NSString to an 32bit byte-array/unsigned char?

1

1 Answers

0
votes

You can get the UTF8 string or c-string in a couple of ways:

NSString *myString = @"Hello";

const unsigned char *string = (const unsigned char *) [myString UTF8String];

const unsigned char *otherString = (const unsigned char *) [myString cStringUsingEncoding: NSASCIIStringEncoding])

Check out the NSString Reference