我已经使用此代码通过 RNcryptor 成功加密了一个文本文件
NSFileManager *filemgr;
NSData *databuffer;
filemgr = [NSFileManager defaultManager];
NSString *destPath = @"Users/DivyaDinesh/Downloads/abcde";
databuffer = [filemgr contentsAtPath: @"Users/DivyaDinesh/Downloads/abcd" ];
NSError *error;
NSData *encryptedData = [RNEncryptor encryptData:databuffer
withSettings:kRNCryptorAES256Settings
password:@"ABC123"
error:&error];
[encryptedData writeToFile:destPath atomically:YES];
然后我尝试使用此代码解密相同
NSString *destPath1 = @"Users/DivyaDinesh/Downloads/abcdg";
NSData *encryptedData = [NSData dataWithContentsOfFile:@"Users/DivyaDinesh/Downloads/abcde"];
NSError *error;
NSData *decryptedData = [RNDecryptor decryptData:encryptedData withPassword:@"ABC123" error:&error];
[decryptedData writeToFile:destPath1 atomically:YES];
我得到一个空白文本文件作为输出,我在这里做错了什么?请帮忙
为什么?如何解决这个问题任何人都可以提供解决方案