CommonCryptorWithData.c [plain text]
#include <stdio.h>
#include <CommonCrypto/CommonCryptor.h>
#include "testbyteBuffer.h"
#include "testmore.h"
#include "capabilities.h"
#if (CCWITHDATA == 0)
entryPoint(CommonCryptoWithData,"CommonCrypto With Data Testing")
#else
#define AES_KEYST_SIZE (kCCContextSizeAES128 + 8)
static int kTestTestCount = 1;
int CommonCryptoWithData(int argc, char *const *argv)
{
CCCryptorStatus retval;
CCCryptorRef cryptor;
unsigned char data[AES_KEYST_SIZE];
plan_tests(kTestTestCount);
byteBuffer key = hexStringToBytes("2b7e151628aed2a6abf7158809cf4f3c");
retval = CCCryptorCreateFromData(kCCEncrypt, kCCAlgorithmAES128,
kCCOptionECBMode, key->bytes, key->len, NULL,
data, AES_KEYST_SIZE, &cryptor, NULL);
ok(retval == kCCSuccess, "Cryptor was created");
return 0;
}
#endif