Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In the openssl docs it states (at http://www.openssl.org/docs/apps/x509.html#INPUT_OUTPUT_AND_GENERAL_PURPOS) that the '-in' option

specifies the input filename to read a certificate from or standard input if this option is not specified.

I am trying to figure out how to sign a CSR (using a private CA) using stdin to send the CSR. The following line generates an error

openssl x509 -req -CA CA.pem -passin pass:abcdefg -set_serial 40 "-----BEGIN CERTIFICATE REQUEST-----###########-----END CERTIFICATE REQUEST-----"

(where ###### represents the CSR data)

The error is:

unknown option -----BEGIN CERTIFICATE REQUEST-----###########-----END CERTIFICATE REQUEST-----

It takes the input to be an option.

Doing

openssl x509 -req -CA CA.pem -passin pass:abcdefg -set_serial 40 -in request.pem

where request.pem contains the EXACT same data that is between the two "'s in the first line is SUCCESSFUL.

What am I doing wrong?

share|improve this question
    
Your question is not really on topic here as we deal more with algorithms, math, and theory. I'm migrating your question to serverfault with the hopes that you'll get better answers. –  mikeazo Aug 2 '12 at 2:17
add comment

migrated from crypto.stackexchange.com Aug 2 '12 at 2:18

This question came from our site for software developers, mathematicians and others interested in cryptography.

1 Answer

Erm, you're not providing the CSR on stdin, you're specifying it as a parameter. To provide it from stdin you either need to redirect it from a file, or pipe it from another command. For example:

echo "-----BEGIN CERTIFICATE REQUEST-----###########-----END CERTIFICATE REQUEST-----" | openssl x509 -req -CA CA.pem -passin pass:abcdefg -set_serial 40

Or, if the CSR is stored in csr.pem:

openssl x509 -req -CA CA.pem -passin pass:abcdefg -set_serial 40 < csr.pem
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.