Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

openssl: how to disable "writing RSA key" message in console

Is there any way to disable console message "writing RSA key"?

$ 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

I tried those commands, with same result :(

like image 915
Artem Mezhenin Avatar asked May 17 '13 11:05

Artem Mezhenin


1 Answers

Running the command with strace shows that the message is written to STDERR:

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

so you have to redirect STDERR instead of STDOUT:

openssl rsa -pubout ... 2>/dev/null
like image 104
Ansgar Wiechers Avatar answered Sep 18 '22 20:09

Ansgar Wiechers