We are using System.Security.Cryptography and AesManaged with a 32 byte key and 16 byte IV, created with Rfc2898DeriveBytes. Are there recommended settings or configuration for how to take advantage of hardware acceleration to increase the performance of encryption and decryption?
It's hard without data or source to say what could be wrong / slow. Is
the key derivation slow ? or the encryption you do afterward ?
A few things that might help...
* Even with it's suffix, `AesManaged` the code will use CommonCrypto
in recent (5.4+) versions of MonoTouch/Xamarin.iOS.
* The same is also true for `HMACSHA1` (used to derive the key) where
the `SHA1` operations will be using CommonCrypto.
* Keep in mind that key derivation algorithms, like
`Rfc2898DeriveBytes`, are not meant to be fast. There's an
IterationCount (defaults to 1000) to ensure brute force attacks and
pre-building dictionaries are "too" costly to be effective.
* Encryption (e.g. AES) performance is often related to the buffer
size and cipher mode you're using, see  and ;
* Using CommonCrypto means it will be native (not managed) crypto but
it _might_ not be hardware accelerated. That decision is up to iOS
itself, depending on several (and undocumented) conditions. If you're
curious I've written a few blog entries on the subject .