Click here to Skip to main content
15,886,110 members
Articles / Desktop Programming / MFC

The Ultimate Toolbox - Updates and User Contributions

Rate me:
Please Sign up or sign in to vote.
4.79/5 (26 votes)
12 Feb 2013CPOL8 min read 254.8K   23.7K   170  
Updates and User Contributions for the Ultimate Toolbox Libraries
// =================================================================
//  class: CUT_CertRequestWizard
//  File:  UT_CertWizard.h
//  
//  Purpose:
//
//	  Certificate request wizard
//       
// ===================================================================
// Ultimate TCP/IP v4.2
// This software along with its related components, documentation and files ("The Libraries")
// is � 1994-2007 The Code Project (1612916 Ontario Limited) and use of The Libraries is
// governed by a software license agreement ("Agreement").  Copies of the Agreement are
// available at The Code Project (www.codeproject.com), as part of the package you downloaded
// to obtain this file, or directly from our office.  For a copy of the license governing
// this software, you may contact us at legalaffairs@codeproject.com, or by calling 416-849-8900.
// ===================================================================

#ifndef UT_CERTWIZARD
#define UT_CERTWIZARD

#ifdef CUT_SECURE_SOCKET

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <windows.h>
#include <windowsx.h>
#include <prsht.h>
#include <tchar.h>
#include <windef.h>


#include "UTCertifMan.h"

extern HANDLE hDllHandle;
#pragma comment(lib, "comctl32.lib")

class UTSECURELAYER_API CUT_CertRequestWizard  
{
public:
	// Constructor/Destructor
	CUT_CertRequestWizard();
	virtual ~CUT_CertRequestWizard();

	// Display the certificate request wizard
	virtual int DisplayWizard(DWORD dwStoreLocation =  CERT_SYSTEM_STORE_CURRENT_USER);
	
	// Return the certificate request data
	virtual LPCSTR GetCertRequest()
		{ return (LPCSTR) m_lpszRequestBuffer; }

	// Set flag to save the request into the buffer only (No saving to file)
	virtual void SetSaveToMemoryOnly(BOOL bFlag)
		{ m_bSaveToBufferOnly = bFlag; }

protected:

	_TCHAR		*m_lpszKeyContainerName;// Name of the key container
	enumPublicKeySize	m_dwKeySize;	// Certificate public key length
	_TCHAR		*m_lpszCommonName;		// Common Name 
	_TCHAR		*m_lpszOrganization;	// Organization Name
	_TCHAR		*m_lpszOrganizationUnit;// Name of the organization unit
	_TCHAR		m_lpszCountry[4];		// Two letter code for the country
	_TCHAR		*m_lpszState;			// Name of the state or province
	_TCHAR		*m_lpszCity;			// Locality 
	_TCHAR		*m_lpszGivenName;		// Given Name 
	_TCHAR		*m_lpszEMail;			// Email 
	_TCHAR		*m_lpszPhone;			// Phone Number
	_TCHAR		*m_lpszRequestBuffer;	// A buffer to hold the returned request
	_TCHAR		*m_lpszFileName;		// Name of the file to save the request data to
	BOOL		m_bOpenWithNotePad;		// Flag to open the file with notepad
	DWORD		m_dwStoreLocation;		// Store location
	HINSTANCE	m_hInstance;			// Application Instance
	int			m_nWizardResult;		// Wizard result error code
	BOOL		m_bSaveToBufferOnly;	// Do not save request to file.

protected:

// v4.2 - update 01 - 64-bit - return values for callbacks changed to INT_PTR
	// Key name and strength dialog
	static INT_PTR CALLBACK KeyStrengthDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
	
	// Error dialog Proc
	static INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
	
	// Organization dialog Proc
	static INT_PTR CALLBACK OrganizationDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
	
	// Common Name Dialog
	static INT_PTR CALLBACK CommonNameDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

	// Geographic Location Dialog
	static INT_PTR CALLBACK GeographicInfoDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
	
	// Contact Information Dialog
	static INT_PTR CALLBACK ContactInfoDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
	
	// Request File Name Dialog
	static INT_PTR CALLBACK RequestFileDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

	// Preview Dialog
	static INT_PTR CALLBACK PreviewDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

	// Set the page style based on I.E.  version
	void SetPageStyle(PROPSHEETPAGE     *psp, LPTSTR szTitle, LPTSTR szSubTitle);

};

#endif // #ifdef CUT_SECURE_SOCKET

#endif // #ifndef UT_CERTWIZARD

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Canada Canada
In January 2005, David Cunningham and Chris Maunder created TheUltimateToolbox.com, a new group dedicated to the continued development, support and growth of Dundas Software’s award winning line of MFC, C++ and ActiveX control products.

Ultimate Grid for MFC, Ultimate Toolbox for MFC, and Ultimate TCP/IP have been stalwarts of C++/MFC development for a decade. Thousands of developers have used these products to speed their time to market, improve the quality of their finished products, and enhance the reliability and flexibility of their software.
This is a Organisation

476 members

Comments and Discussions