Use native crypto APIs on Android and iOS


Using RSACryptoServiceProvider in particular (but also true for symmetric encryption) is dog slow on mono, since it's all implemented in managed code.

It's been proven to be 100X+ faster to use the native APIs for the platform. For example, RSA key generation using the Java APIs on Android can take seconds when the RSACryptoServiceProvider on Android can sometimes take hours. Yikes!

The trick here is to still maintain interoperability in how the RSA keys are formatted so that they can be exchanged across platforms and allow message communication across those platforms.
Closed Mar 23, 2014 at 3:00 PM by AArnott
iOS now uses native crypto as well, as of 159994a


AArnott wrote Mar 9, 2014 at 10:57 PM

Merge commit 05009f504b7fb adds native crypto usage on Android.
I confirmed that 4096 bit RSA key generation was 30X faster.