Data Encryption with AES

I am creating an application that will communicate with the server (php), and this is a message (possibly from json) that I want to encrypt. After a lot of searching and reading, I found the AESCrypt-Objc project. When testing encryption (I use the AES Encryption test web tool ), I found that as a result of encryption I was missing 16 bytes of data. Here is an example that I use In the AES project:

The line to be encrypted is: "A quick brown fox jumped over a lazy dog." Password: "12345678901234561234567890123456"

Result:

<7eda336b 82f3e279 ae7638fe cccfffc6 5fbef8da 6df76d97 67d8cfa8 5bce2ae9>

My code is:

self.strnToBeEnc = @"The quick brown fox jumped over the lazy dog";
self.appKey      = @"12345678901234561234567890123456";
NSData *data2    = [self.strnToBeEnc dataUsingEncoding:NSUTF8StringEncoding];
NSLog(@"%@", data2); 
NSData *s2 = [data2 AES256EncryptedDataUsingKey:self.appKey error:nil]; 
NSLog(@"%@", s2);

WEB tool:

Same line and password

Result:

< 7eda336b 82f3e279 ae7638fe cccfffc6 5fbef8da 6df76d97 67d8cfa8 5bce2ae9 ca2ed34a 48f85af2 909654d5 b0de0fb7 >

, ...:) , .

?

( , , )

+4
1

, , , , , AESCrypt-Objc, , - .

, CCCryptorFinal, . AESCrypt-ObjC/NSData + CommonCrypto.m _runCryptor:result:. , , - , , kCCOptionPKCS7Padding, .

, AES, , , .

+2

Source: https://habr.com/ru/post/1533964/


All Articles