0

I have recorded an audio file.what I need is I have to encrypt the audio file in Xcode programmatically,and then send it to the server.So kindly tell me how to encrypt the file.Thanks in advance.

pie
  • 230
  • 1
  • 3
  • 9
  • Kindly tell me how to do this. – pie Apr 02 '12 at 13:31
  • Any reason not to use SSL for transport encryption rather than encrypting the file itself? – jnic Apr 02 '12 at 14:05
  • I don't know about this kindly tell me how to do this? – pie Apr 02 '12 at 14:07
  • Set up your web server with an SSL certificate, then upload the file to the https URL. [Here's the How-To for Apache](http://httpd.apache.org/docs/2.0/ssl/ssl_howto.html), other web servers will have similar steps. – jnic Apr 02 '12 at 14:11

3 Answers3

0

Use the category in the answer at the link, and add this in your project and #include "CommonCryptor.h". Get the audio as NSData, then [data AES256EncryptWithKey:key] where key is some NSString containing your password. See: AES Encryption for an NSString on the iPhone

Community
  • 1
  • 1
Adam Shiemke
  • 3,734
  • 2
  • 22
  • 23
  • when I am using the [data AES256EncryptWithKey:key] I am getting the warnings 1.Instance method AES256EncryptWithKey: not found – pie Apr 02 '12 at 13:25
  • See the first answer in the link. The linked code needs to be included. It adds the AES256EncryptWithKey method to NSData via a category. Lots nicer than CCCrypt(). – Adam Shiemke Apr 02 '12 at 13:45
0

You can encrypt your NSData using this.

Vignesh
  • 10,205
  • 2
  • 35
  • 73
  • In this there are so many files tell me what file I have to use – pie Apr 02 '12 at 13:29
  • Hi Vignesh,here I want to encrypt the below image.So in ViewDidLoad I have written the NSData *data1 = [[NSData alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"arrow_glossy_up_blue" ofType:@"png"]]; NSData *encryptedData = [data1 AES256EncryptedDataUsingKey:@"srinu" error:nil]; at this line it is giving error like this. [NSConcreteData AES256EncryptedDataUsingKey:error:] unrecognized selector sent to instance ..... – pie Apr 02 '12 at 13:48
  • did you import the NSData+commonCrypto file?. – Vignesh Apr 02 '12 at 13:52
  • I have used this #import "NSData+CommonCrypto.h" – pie Apr 02 '12 at 13:53
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/9597/discussion-between-pie-and-vignesh) – pie Apr 02 '12 at 13:56
0

You could compress it with zlib library.

There's a wrapper called objective-zip for it.

It also supports encryption.

Also take a look at accepted answer at compressed file format for Iphone

Community
  • 1
  • 1
Rok Jarc
  • 18,765
  • 9
  • 69
  • 124