-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

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

  • 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
  • 1
    See discussion of library vs system at this question: security.stackexchange.com/questions/34062/… – Eric G Apr 10 '13 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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