简体   繁体   English

如何在Linux上为Node.js加密启用AES-NI(硬件加速)?

[英]How do I enable AES-NI (hardware acceleration) for Node.js crypto on Linux?

I wrote a basic function to test the speed of the AES-256-CBC mode of the Node.js built-in crypto functions. 我编写了一个基本函数来测试Node.js内置加密函数的AES-256-CBC模式的速度。 These functions use OpenSSL, so they should support AES-NI, but when I correctly enable AES-NI and do a command-line test of OpenSSL the encryption speed is ~350MB/s on OpenSSL and only ~100MB/s on Node.js Crypto. 这些功能使用OpenSSL,因此它们应该支持AES-NI,但是当我正确启用AES-NI并对OpenSSL进行命令行测试时,OpenSSL的加密速度为〜350MB / s,而Node.js的加密速度仅为〜100MB / s。加密货币。

I used this answer to enable OpenSSL AES-NI in the command line and ran it as follows: 我使用此答案在命令行中启用OpenSSL AES-NI并如下运行:

openssl speed -evp aes-256-cbc

My question is, how do I make the speed of the Node.js crypto functions for AES match that of OpenSSL run in the command line? 我的问题是,如何使AES的Node.js加密函数的速度与在命令行中运行的OpenSSL的速度匹配? I suspect the reason is failure to use AES-NI 我怀疑原因是无法使用AES-NI

It seems that this was not correctly enabled until the latest release v0.12 (that was just released publicly). 在最新版本v0.12(刚刚公开发布)之前,似乎没有正确启用此功能。

Some of the notes are available here http://strongloop.com/strongblog/performance-node-js-v-0-12-whats-new/ 此处提供了一些说明, 网址为http://strongloop.com/strongblog/performance-node-js-v-0-12-whats-new/

No, you are doing it right. 不,您做对了。 The performance of OpenSSL in Node is a bit disappointing. Node中OpenSSL的性能令人失望。 Most production Node.js deployments terminate SSL connections in something other than Node.js and then forward the unencrypted connections to Node.js. 大多数生产Node.js部署会终止Node.js之外的SSL连接,然后将未加密的连接转发到Node.js。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Linux 上运行 node.js 时如何解决“服务器提前终止,状态为 127”的问题? - How do I solve “Server terminated early with status 127” when running node.js on Linux? 如何降级 node.js? - How do I downgrade node.js? 如何设置 Linux 环境变量,以便 pm2 可以在 node.js 应用程序中看到它们? - How do I set Linux environment variables so that pm2 can see them for node.js apps? 如何为Tegra 2 Linux的libEGL启用硬件支持? - How to enable hardware support for libEGL for Tegra 2 Linux? JavaFX:在Linux上经过测试/确认的硬件(GPU)加速 - JavaFX: Tested/confirmed hardware (GPU) acceleration on Linux 如何获得Linux / Unix上的硬件信息? - How do I get hardware information on Linux/Unix? 如何使用可读的非阻塞输出管道在linux上的python中启动node.js子进程 - How can I start a node.js subprocess in python on linux with a readable non-blocking output pipe 如何在 aws 上的 Amazon Linux AMI 中自动启动 node.js 应用程序? - How can I automatically start a node.js application in Amazon Linux AMI on aws? node.js如何获得Linux发行版本? - How node.js get the Linux release version? 如何在Linux服务器上的端口80上启动node.js? - How to start node.js on port 80 on a linux server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM