Information Security Stack Exchange is a question and answer site for information security professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is an openSSL command for generating a private key and a certificate,

openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key

The question I have is whether there is some way to run this command within an executable compiled from C?

share|improve this question
You might want to split your two question into separate posts, the one about MiTM is not directlyt related to coding this in C. – Eric G Apr 8 '13 at 4:27
Better now? deleted some of the MITM stuff, I found it anyways here… – lost_with_coding Apr 8 '13 at 4:48
up vote 2 down vote accepted

In C system() function executes an internal operating system command. If the command execution is terminated the command processor will give the control back to the program that has called the system command.

It takes a C String as a an example

int main ()
char c[50];
strcpy( c, "command string" );
return 0;

You can see the man page here

share|improve this answer
Are there any security implications or real performance notifications to calling the program and getting the output versus loading it as a library directly in your software? I would imagine version control might be one concern. – Eric G Apr 8 '13 at 14:34
@EricG to tell you the truth i have no idea but i think you should post a question about it and let us see what the community has to say – Shurmajee Apr 9 '13 at 5:31
See discussion of library vs system at this question:… – Eric G Apr 10 '13 at 1:36

If you want to have your program call another executable, than it would be required to be installed on the system (it's open source so in most cases you should be able to ship or incorporate somehow). OpenSSL also provides some libraries for programmers, see the C Header files documentation.

Here are some tutorials about progamming with OpenSSL:

May also want to search and check over on Stack Overflow.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.