:+1:


On Fri, Feb 14, 2014 at 2:45 PM, Christos Vasilakis <
notifications@github.com> wrote:

> In docs/guides/aerogear-ios/Cryptography.asciidoc:
>
> > +    }];
> > +
> > +    // ok time to attempt reading..
> > +    NSArray *data = [store readAll]) { // 9
> > +
> > +    if (data)
> > +        // decryption succeeded!
> > +
> > +
> > +----
> > +
> > +In [1] we initialize a random _salt_ that will be used in the encryption. In [2] we initialize an instance of a link:http://aerogear.org/docs/specs/aerogear-ios/Classes/AGCryptoConfig.html[CryptoConfig] configuration object to set our crypto params. Here we use an http://aerogear.org/docs/specs/aerogear-ios/Classes/AGPassphraseCryptoConfig.html[PassphraseCryptoConfig] object, that sets the necessary crypto params for the PBKDF2 Encryption Service, mainly the salt [3] and the passphrase [4].
> > +
> > +Now that we have setup the configuration, it's time to obtain an instance of an link:http://aerogear.org/docs/specs/aerogear-ios/Classes/AGEncryptionService.html[EncryptionService] and that's exactly what we do in [5]. link:http://aerogear.org/docs/specs/aerogear-ios/Classes/AGKeyManager.html[KeyManager] parses the configuration and returns an instance of it. Because we passed an http://aerogear.org/docs/specs/aerogear-ios/Classes/AGPassphraseCryptoConfig.html[PassphraseCryptoConfig] object, a PBKDF2 encryption service would be returned.
> > +
> > +In [6] we initialize our data store (an encrypted plist [7]), setting the encryption service we obtained earlier [8]. Reading and saving operations are done like all the other stores, but this time the data are transparently encrypted/decrypted.
>
> I see yeap, have included a sentence which goes like:
> "In [9] we attempt to read data from the store. If that fails, then user
> supplied wrong crypto parameters (either passphrase or salt)."
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/aerogear/aerogear.org/pull/250/files#r9748360>
> .
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf