secureswitools/makekeys/src/MAKEKEYS.CPP
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
     1 /*
     1 /*
     2 * Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    54 
    54 
    55 CMakeKeys::CMakeKeys()
    55 CMakeKeys::CMakeKeys()
    56 :m_fVerbose(FALSE)
    56 :m_fVerbose(FALSE)
    57 	{ ; }
    57 	{ ; }
    58 
    58 
    59 int CMakeKeys::Run(const int argc, const _TCHAR *argv[])
    59 int CMakeKeys::Run(const int argc, const _TCHAR *argv[], const _TCHAR *envp[])
    60 // Inputs   : argc, argv, envp - The command line passed to the process
    60 // Inputs   : argc, argv, envp - The command line passed to the process
    61 	{	
    61 	{	
    62 	BOOL bValid = TRUE;
    62 	BOOL bValid = TRUE;
    63 	m_KeyGen = NULL;
    63 	m_KeyGen = NULL;
    64 	pMakeCert = NULL;
    64 	pMakeCert = NULL;
   115 			{
   115 			{
   116 			char Warn[128];
   116 			char Warn[128];
   117 
   117 
   118 			OUT << _T("Warning: the private key should be encrypted with the -password option") << endl;
   118 			OUT << _T("Warning: the private key should be encrypted with the -password option") << endl;
   119 			OUT << _T("Do you want to use a password (y/n)? ");
   119 			OUT << _T("Do you want to use a password (y/n)? ");
   120 			OUT.flush();
       
   121 
   120 
   122 			cin >> Warn;
   121 			cin >> Warn;
   123 
   122 
   124 			if (stricmp(Warn, "n") != 0)
   123 			if (stricmp(Warn, "n") != 0)
   125 				{
   124 				{
   165 				{
   164 				{
   166 				char Warn[128];
   165 				char Warn[128];
   167 
   166 
   168 				OUT << _T("Warning: the private key should be encrypted with the -password option") << endl;
   167 				OUT << _T("Warning: the private key should be encrypted with the -password option") << endl;
   169 				OUT << _T("Do you want to use a password (y/n)? ");
   168 				OUT << _T("Do you want to use a password (y/n)? ");
   170 				OUT.flush();
       
   171 
   169 
   172 				cin >> Warn;
   170 				cin >> Warn;
   173 
   171 
   174 				if (stricmp(Warn, "n") != 0)
   172 				if (stricmp(Warn, "n") != 0)
   175 					{
   173 					{
   296 		}
   294 		}
   297 
   295 
   298 	// main function - constructs a CMakeKeys object and calls it's run method
   296 	// main function - constructs a CMakeKeys object and calls it's run method
   299 	extern "C"
   297 	extern "C"
   300 		{
   298 		{
   301 		int main(int argc, const char *argv[], const char *envp[])
   299 		int _tmain(int argc, const _TCHAR *argv[], const _TCHAR *envp[])
   302 			{
   300 			{
   303 			// MingW doesn't support _tmain(),
       
   304 			// so using GetCommandLineW() to get wide args.
       
   305 			wchar_t** argvW = CommandLineToArgvW( GetCommandLineW(), &argc);
       
   306 			
       
   307 			CMakeKeys app;
   301 			CMakeKeys app;
   308 			return app.Run(argc, argvW);
   302 			return app.Run(argc, argv, envp);
   309 			}
   303 			}
   310 		}
   304 		}