问题描述
我使用AES目前执行在C#中的大量文本的加密/解密。
通过一个纯软件系统,它可以采取相当的处理器打的时间为大量需要被解密的数据集像样的数目。我知道,英特尔已经推出了自己的AES-NI指令集和AMD已经推出了类似的。
我使用的是.NET 4.0,我知道,在Windows CNG框架使得使用这些指令集,但它不会出现 AesManaged
在.NET世界不相同。
不过有一个梦幻般的项目 CLR安全这使得网关从.NET 3.5到Windows CNG,它并没有被保留一年,我宁愿不(如果可能)跳上一个垂死的项目。
有一个在.NET 4 CNGProvider类,但似乎没有给足够的文件凑齐从它的工作解密AES。
有没有人有这个专题的经验,他们可以点我在正确的方向上如何获得AES-NI在纯.NET环境中实现,使用pre-发班,而不必做AP /直接调用从C#? (它会被罚款,如果有一个包装类做,只要维持)。
本评论有帮助非常大,做一些挖掘它看起来像AesCryptoServiceProvider将使用AES-NI,如果菱后,我看不出有这方面的官方从微软的文档但是,当运行简单的定时基准不同的是〜15倍的速度更快,以便无论是API本身massivly优化(这对于一款15倍增加pretty的漂亮优化),或者使用了AES-NI指令集。
Unfortunatley我没有一个非AES-NI箱测试,但如果我得到一个我会更新这个帖子的效果。
所以我pretty的信心,这是用于AES-NI的API,但不能没有机制保障进一步的测试。
I Currently perform a large amount of encryption/decryption of text in c# using AES.
With a pure software system it can take quite a processor hit for a decent amount of time for the lots of datasets required to be decrypted. I know Intel have came out with their AES-NI instruction set and AMD has come out with similar.
I'm using .NET 4.0, I know that the windows CNG framework makes use of these instruction sets, but it does not appear that AesManaged
in the .NET world does the same.
There is a fantastic project "CLR Security" which makes a gateway from .NET 3.5 to the windows CNG, however it hasn't been maintained in a year and I'd rather not (if possible) jump on a dying project.
There is a CNGProvider class in .NET 4 but there doesn't appear to be adequate documentation to cobble together a working decryption from it for AES.
Does anyone have experience with the topic they could point me in the right direction on how to get AES-NI implemented in a pure .NET environment, using pre-made classes, without having to do a p/invoke directly from c#? (It'd be fine if there was a wrapper class doing it, as long as it was maintained).
This comment has helped tremendously, after doing some digging it looks like AesCryptoServiceProvider will use AES-NI if availible, I cannot see any 'official' documentation from Microsoft on this however when running simple timing benchmarks the difference is ~15x faster so either the API itself is massivly optimized (which for a 15x increase is pretty nice optimization) or it uses the AES-NI instruction set.
Unfortunatley I don't have a non AES-NI box to test on, but if I ever get one I'll update this thread with results.
So I'm pretty confident this is the API to use for AES-NI but cannot guarentee without further testing.
这篇关于如何在.NET中使用CNG(或AES-NI激活指令集)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!