I'm trying to encrypt data with AES128, I have the right to be treated as a key text string production meets, but only to treat the key as trying binary trash
implementation I'm using it:
- (NSData *) AES128EncryptWithKey :. (NSString *) key {four keyPtr [kCCKeySizeAES256 + 1]; Berboo (keypets, keyboards); [Key getCString: keyPtr maxLength: sizeof (keyPtr) encoding: NSUTF8StringEncoding]; NSUntiger DataLong = [Self length]; Size_t BufferSecurity = DataLanguage + KCCBlockSizeAES128; Zero * buffer = molok (buffer size); NSLog (@ "keyPtr:% s", keyPtr); Size_t numBytesEncrypted = 0; CCCryptorStatus cryptStatus = CCCrypt (kCCEncrypt, kCCAlgorithmAES128, 0x00, keyPtr, kCCKeySizeAES256, zero, [self-bytes], dataLength, buffer, bufferSize, & amp; numBytesEncrypted); If (cryptStatus == kCCSuccess) {return [NSData dataWithBytesNoCopy: buffer length: numBytesEncrypted]; } Free (buffer); Return zero; }
Encryption is actually what I need.
With my implementation I get a right encryption for the same plane key but I do not find a way to treat the key as the hex is not working as the NSData key To get the code tried to modify the code above but, I get garbage only after encryption. Of
I have searched and not found an answer on this specific topic, I hope I was right, TIA :)
No comments:
Post a Comment