Well, it’s possible you’re doing it properly … but likely not. At CocoaConf Chicago Rob Napier gave a presentation on iOS security and highlighted his cross-platform AES encrypt/decrypt library, RNCryptor. You’ll find implementations for Swift, Objective-C, Java, PHP, C, JavaScript, Haskell, Go, and many more.
Do you know what password stretching, CBC, PBKDF2, and IVs are? If you’ve said no to any of these, you should probably look at RNCryptor.
Check it out!