Xy, 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 [1] and [2]; * 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 [3]. Sebastien [1] http://spouliot.wordpress.com/2012/05/02/managed-crypto-vs-commoncrypto-deciphering-results/ [2] http://spouliot.wordpress.com/2012/02/27/cryptodev-support-in-crimson/ [3] http://spouliot.wordpress.com/category/crypto/ On Wed, Mar 27, 2013 at 11:57 PM, Xy <[email protected]> wrote: > Hi, > > 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? > > Thanks, > > XY > > > > -- > View this message in context: > http://monotouch.2284126.n4.nabble.com/Slow-Encryption-Decryption-Performance-tp4658192.html > Sent from the MonoTouch mailing list archive at Nabble.com. > _______________________________________________ > MonoTouch mailing list > [email protected] > http://lists.ximian.com/mailman/listinfo/monotouch _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
