Clearly the .NET AesManaged
implementation is not hardware accelerated. Searches of SO and Google indicate that AesCryptoServiceProvider
(which is a wrapper over the OS crypto) is generally much slower than the AesManaged
implementation.
However, I have found that the AesCryptoServiceProvider
was actually faster, way faster, as in order of magnitude difference. I'm suspecting that the OS level implementation is actually handing AES-NI instructions off to the CPU for hardware acceleration.
I cannot locate any documentation on the above observation, but if my suspicions are correct then at least on a Core i7 4770 CPU running 64-Bit Windows 8.1 Update 1, the AesCryptoServiceProvider
is hardware accelerated.
Performance observations are that on the above machine, 8 threads of AES CBC decryption using AesManaged
will max out the CPU and consume as much memory as needed for the data (i.e. for us 32GB of RAM gets maxed out regularly). The exact same code but using AesCryptoServiceProvider
has the CPU cores average around 30-40% and memory (private working bytes) seldom go over 10GB.
To semi-answer my own question, try AesCryptoServiceProvider
, especially on 64-bit Windows 8.1 Update 1.