-(NSData *) decryptData:(NSData *) Data
{
NSData *iv;
NSData *salt;
NSError *error;
NSData *stringData = Data;
NSInputStream *inpStream = [[NSInputStream alloc] initWithData:stringData];
bool IVData = [inpStream _CMgetData:&iv maxLength:kAlgorithmIVSize error:&error];
bool SaltData = [inpStream _CMgetData:&salt maxLength:kPBKDFSaltSize error:&error];
}
@implementation NSInputStream (Data)
-(BOOL)_CMgetData:(NSData **)data maxLength:(NSUInteger)maxLength error:(NSError **)error {
NSMutableData *buffer = [NSMutableData dataWithLength:maxLength];
if ([self read:buffer.mutableBytes maxLength:maxLength] < 0)
{
if (error)
{
*error = [self streamError];
NSLog(@"CMgetData Error!!");
return NO;
}
}
*data = buffer;
NSLog(@"%@", buffer);
return YES;
}
@end
我总是收到“CMgetData 错误!!” 有谁知道为什么会出现这个问题。我相信我正确传递了所有参数。那正确吗??请帮助提前谢谢任何帮助?