openssl:如何在控制台中禁用“编写RSA密钥”消息

时间:2013-05-17 11:42:53

标签: bash shell openssl

有没有办法禁用“写RSA密钥”控制台消息?

$ openssl rsa -pubout -outform DER -inform PEM -in /tmp/res/chrome.pem -out 1 > /dev/null 
writing RSA key
$ openssl rsa -pubout -outform DER -inform PEM -in /tmp/res/chrome.pem -out 1
writing RSA key
$ openssl rsa -pubout -outform DER -inform PEM -in /tmp/res/chrome.pem > /dev/null
writing RSA key

我尝试了这些命令,结果相同:(

1 个答案:

答案 0 :(得分:4)

使用strace运行命令会显示该消息已写入STDERR

write(2, "writing RSA key\n", 16)       = 16
      ^

因此您必须重定向STDERR而不是STDOUT

openssl rsa -pubout ... 2>/dev/null