I haven't done any CLI C++ in a long time so there's probably a much cleaner way of doing this but you could just iterate over the encrypted data like this;
char* encrypted = "Hello, World!";
int length = 13;
unsigned char socketData __gc[] = new unsigned char __gc[length];
for(int i = 0; i < length; ++i)
{
socketData[i] = static_cast<unsigned char>(encrypted[i]);
}
Hope this helps,
Fredrik Bornander