-1

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?

2
  • 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, 2013 at 4:27
  • 1
    Better now? deleted some of the MITM stuff, I found it anyways here security.stackexchange.com/questions/26142/… Apr 8, 2013 at 4:48

2 Answers 2

2

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 parameter.as an example

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

You can see the man page here

3
  • 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, 2013 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, 2013 at 5:31
  • 1
    See discussion of library vs system at this question: security.stackexchange.com/questions/34062/…
    – Eric G
    Apr 10, 2013 at 1:36
2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .