-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?

pandoragami
  • 599
  • 1
  • 6
  • 8
  • 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 08 '13 at 04:27
  • 1
    Better now? deleted some of the MITM stuff, I found it anyways here http://security.stackexchange.com/questions/26142/do-client-certificates-provide-protection-against-mitm?rq=1 – pandoragami Apr 08 '13 at 04:48

2 Answers2

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.

Eric G
  • 9,691
  • 4
  • 31
  • 58
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

Shurmajee
  • 7,285
  • 5
  • 27
  • 59
  • 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 08 '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 09 '13 at 05:31
  • 1
    See discussion of library vs `system` at this question: http://security.stackexchange.com/questions/34062/using-openssl-as-a-library-versus-calling-output-from-standalone-command-in-a-pr – Eric G Apr 10 '13 at 01:36