0

i have a working code below in objective-c for encrypting an NSString.

    NSString *password = @"mypassword";
NSString *str = @"hello world 123"; 

NSLog(@"encrypting string = %@",str);

NSData *data = [str dataUsingEncoding: NSASCIIStringEncoding];
NSData *encryptedData = [data AESEncryptWithPassphrase:password];

[Base64 initialize];
NSString *b64EncStr = [Base64 encode:encryptedData];

NSLog(@"Base 64 encoded = %@",b64EncStr);

what i want is to send the encrypted text to java and decrypt it. can someone guide me with the java code.

  • Relevant: http://stackoverflow.com/q/6486121/636009 http://stackoverflow.com/a/15646871/636009 – David Conrad May 13 '14 at 16:28
  • 1
    You have to have the same encryption algorithm, the same password, the same block size, and the same "salt" algorithm. And then not screw up. Simple. – Hot Licks May 13 '14 at 16:48

0 Answers0