"PROGRAM RECEIVED SIGNAL: EXC_BAD_ACCESS" with RNCryptManager.m

408 Views Asked by At

I am new to this encryption/decryption and I received following error

"PROGRAM RECEIVED SIGNAL: EXC_BAD_ACCESS" IN RNCryptManager.m of DEcryptdata

NSData *key = [self AESKeyForPassword:password salt:salt]; 

When trying to encrypt/decrypt a string with password as "password" using RNCryptmanager.h amd .m files

NSData *en = [RNCryptmanager encryptedDataForData:data1 password:password1 iv:ivv salt:salt1 error:error];
values for iv and salt is a random data
NSData *ivv = [self randomData:32];
NSData *salt1 = [self randomdata:16];
1

There are 1 best solutions below

0
On

Note that RNCryptManager has been superseded by RNCryptor, which has more features and improved security.

You should be receiving warnings about this code, which suggests you're ignoring warnings. You must never ignore warnings in ObjC.

The iv, salt, and error parameters are pass-by-reference. This method returns them; it doesn't take them. It should look like:

NSData *en = [RNCryptmanager encryptedDataForData:data1
                             password:password1 
                             iv:&ivv 
                             salt:&salt1
                             error:&error];

See CPCryptController for an example.