4

I'm new to encrypting in iOS and i'm stuck with AES128 encryption. Is there some pre-built library (perhaps OpenSSL) which i can use easily?

If so, how do I implement it and use it? Are there tutorials?

I've found several "easy" tutorials how to build OpenSSL and import it to Xcode, but none of them worked for me. Also, it needs to be compatible with iOS4, so solution via CommonCrypto doesn't seem to be a solution (since several essential methods are only iOS 5+ compatible).

Thanks for any kind of help, i'm pulling my hair out over this :)

Daniel
  • 23,129
  • 12
  • 109
  • 154
animal_chin
  • 6,610
  • 9
  • 37
  • 41

2 Answers2

2

This is written in Obj-C and allows for AES128 encryption of NSString and NSData.

I take it back. It uses CommonCrypt.

Daniel
  • 23,129
  • 12
  • 109
  • 154
citruspi
  • 6,709
  • 4
  • 27
  • 43
  • i've found those protocols earlier but i thought they aren't compatible with iOS 4 (just iOS5)...do you have some experience with using them? As i wrote in my Q - they use CommonCrypto/CommonCryptor.h ... – animal_chin Apr 19 '12 at 22:27
  • @animal_chin I found it from [this post](http://tharindufit.wordpress.com/2011/12/15/aes128-encryption-in-ios-and-decryption-in-php/). – citruspi Apr 19 '12 at 22:30
  • @animal_chin I've also been having an issue similar to this... In my case, I need to securely send a password to a server. Although I would prefer my code be compatible with all OS's, I realize that newer firmwares come with new features which should be embraced. See my question [here](http://stackoverflow.com/questions/9934189/securely-send-a-plain-text-password). – citruspi Apr 19 '12 at 22:33
  • @animal_chin And, you're welcome... Sorry I couldn't help. Hope you find the answer... :) – citruspi Apr 19 '12 at 22:34
  • i've just read your Q and it really looks very similar to my problem... lucky you, taht you have to encrypt only password, i have to encrypt whole JSON file with several methods :) hopefully there will be someone who will be able to answer us :) – animal_chin Apr 19 '12 at 22:46
  • What will the JSON contain? As in, how secure does it need to be? – citruspi Apr 19 '12 at 22:50
1

If anyone is still interested in this question i found a solution on http://dotmac.rationalmind.net/2009/02/aes-interoperability-between-net-and-iphone/ . On this page you can download very simple obj-c classes which are compatible with iOS4 and doesn't need any 3rd party libraries.

animal_chin
  • 6,610
  • 9
  • 37
  • 41