One often repeated piece of advice with respect to adding crypto to your app is to never roll your own crypto. That is, never reimplement a crypto algorithm from scratch. This is very good advice. There are already several different libraries to choose from...