24 int main(
int argc,
char* argv[])
27 #ifdef HAVE_OPENSSL_SSL_H 29 string sslcert = string(MCS_SSLCERT);
30 string sslpriv = string(MCS_SSLPRIV), s;
39 cout <<
"Creating SSL private key and certificate for MCS server..." << endl << endl;
41 cout <<
"The private key can be protected by a password, this is needed if the " << endl;
42 cout << sslpriv <<
" file can be read by other users." << endl;
43 cout <<
"If you choose to provide a password then you must enter that password " << endl;
44 cout <<
"each time you execute the server." << endl << endl;
46 cout <<
"Protect the private key with a password (y/n) ? [y]" << endl;
49 s = ( ((s ==
"") || (s[0] ==
'y') || (s[0] ==
'Y')) ?
" -des3 " :
"");
51 s =
"openssl genrsa " + s +
" -out " + string(MCS_SSLPRIV) +
" 2048";
52 cout << endl << endl << s << endl;
53 i = system(s.c_str());
55 cerr <<
"Error executing openssl" << endl;
59 s =
"openssl req -new -x509 -batch -key " + string(MCS_SSLPRIV) +
60 " -out " + string(MCS_SSLCERT);
61 cout << endl << endl << s << endl;
63 i = system(s.c_str());
65 cerr <<
"Error executing openssl" << endl;
70 cout <<
"Files for private key and certificate already exists:" << endl;
71 cout <<
" " << sslpriv << endl;
72 cout <<
" " << sslcert << endl;
74 #else //HAVE_OPENSSL_SSL_H 75 cerr <<
"The SSL support has been disabled, try: ./configure --enable-openssl" << endl;
77 #endif //HAVE_OPENSSL_SSL_H bool File_Dir_Exist(string fn, unsigned int &size)
Check if a file or directory exists.
Main include file for all MCS based applications.