-5

I am newbie for iOS. I try to encrypt string with AES256. I follow instruction in this question : AES Encryption for an NSString on the iPhone

I confuse to understand yellow marked words.

enter image description here

Previous, I copy above codes. But I get error...

enter image description here

Why I can get error ? Because I don't insert adapted code that have been marked by yellow ink at top picture. That yellow marked words linked to here : http://pastie.org/426530#

MY MAIN QUESTIONS IS : I CONFUSE TO INSERT ADAPTED CODE IN TOP ANSWER IN THIS LINK AES Encryption for an NSString on the iPhone

I don't understand how to copy source code inside that link. I doubt I just create class NSData. From what I know, NSData is class from C-Objective libraries

Community
  • 1
  • 1
AndikaK
  • 137
  • 1
  • 15
  • What are the errors? – jscs Oct 06 '14 at 18:49
  • Please, read first before voting. I confuse to follow instruction – AndikaK Oct 06 '14 at 18:51
  • 1
    "Adapted" in this case just means "modified." The writer is just indicating that the code used is not precisely the same as originally written. This answer, however, is referring to a very insecure piece of code (not listed in your description). It is a terrible way to encrypt data. – Rob Napier Oct 06 '14 at 18:54
  • Oh, I am new in learning encryption. How to insert/modify the adapted code ? The adapted code is http://pastie.org/426530# – AndikaK Oct 06 '14 at 18:56
  • @WrightsCS links the instructions below. But keep in mind that this is very insecure code and should not be used for anything requiring significant encryption. For a full explanation of the problems with this code, see http://robnapier.net/aes-commoncrypto – Rob Napier Oct 06 '14 at 19:00

2 Answers2

0

There is source code after the first return in that main function. @autoreleasepool is not a conditional; code within the block will execute 100% of the time.

Ian MacDonald
  • 13,472
  • 2
  • 30
  • 51
0

Seems to me like this code had a class category of NSData that contained a custom method for AES256EncryptWithKey:, AES256DecryptWithKey:.

See this answer https://stackoverflow.com/a/11483134/171206 on SO that shows you how to implement this.

Community
  • 1
  • 1
WrightsCS
  • 50,551
  • 22
  • 134
  • 186