0

*cipher.h, cipher.m all code : http://watchitlater.com/blog/2010/02/java-and-iphone-aes-interoperability

Cipher.m

-(NSData *)encrypt:(NSData *)plainText{
 return [self transform:KCCEncrypt data:plainText;
}

step1.

Cipher *cipher = [[Cipher alloc]initWithKey:@"1234567890"];

NSData *input = [@"kevin" dataUsingEncoding:NSUTF8StringEncoding];

NSData *data = [cipher encrypt:input];

data variables NSLog print : <4d1c4d7f 1592718c fd588cec 84053e35>

step2.

NSString *changeVal = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

data variables NSLog print : null

NSData to NSString by changing the value null is returned. By converting NSString NSURLConnection want to transfer. I need you help

2

1 Answer 1

0

Kevin, I actually take the result of the cipher encrypt method and use an extension to NSData to convert it to a Base64 encoded string. The cipher text does NOT convert to a valid UTF8 string by itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.