⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adminoptions.c

📁 PGP8.0源码 请认真阅读您的文件包然后写出其具体功能
💻 C
📖 第 1 页 / 共 3 页
字号:
		
		// Set up the key generation page
		
		psp[nNumPages].pszTemplate	= MAKEINTRESOURCE(IDD_KEYGEN);
		psp[nNumPages].pfnDlgProc	= (DLGPROC) KeyGenDlgProc;
		nNumPages++;
		
		// Set up the default key selection page
		
		psp[nNumPages].pszTemplate	= MAKEINTRESOURCE(IDD_DEFKEYSEL);
		psp[nNumPages].pfnDlgProc	= (DLGPROC) DefaultKeysDlgProc;
		nNumPages++;
		
		// Set up the corporate key page
		
		psp[nNumPages].pszTemplate	= MAKEINTRESOURCE(IDD_CORPKEY);
		psp[nNumPages].pfnDlgProc	= (DLGPROC) CorpKeyDlgProc;
		nNumPages++;

		// Set up the revoker key page
		
		psp[nNumPages].pszTemplate	= MAKEINTRESOURCE(IDD_REVOKER);
		psp[nNumPages].pfnDlgProc	= (DLGPROC) RevokerDlgProc;
		nNumPages++;
	}
	
	// Set up the server updates page

	psp[nNumPages].pszTemplate	= MAKEINTRESOURCE(IDD_SERVERUPDATES);
	psp[nNumPages].pfnDlgProc	= (DLGPROC) ServerUpdatesDlgProc;
	nNumPages++;
	
	// Set up the access page

	psp[nNumPages].pszTemplate	= MAKEINTRESOURCE(IDD_ACCESS);
	psp[nNumPages].pfnDlgProc	= (DLGPROC) AccessDlgProc;
	nNumPages++;
	
	// Set up the install options page

	psp[nNumPages].pszTemplate	= MAKEINTRESOURCE(IDD_INSTALLOPTIONS);
	psp[nNumPages].pfnDlgProc	= (DLGPROC) InstallOptionsDlgProc;
	nNumPages++;
	
	if (nProduct & (Installer_PGPds | Installer_PGPmail | Installer_PGPdisk | 
		Installer_PGPvpn))
	{
		// Set up the miscellaneous page
		
		psp[nNumPages].pszTemplate	= MAKEINTRESOURCE(IDD_MISC);
		psp[nNumPages].pfnDlgProc	= (DLGPROC) MiscDlgProc;
		nNumPages++;
	}
	
	// Create the header

	psh.dwSize		= sizeof(PROPSHEETHEADER);
	psh.dwFlags		= PSH_PROPSHEETPAGE;
	psh.hwndParent	= hwndMain;
	psh.hInstance	= g_hInstance;
	psh.hIcon		= NULL;
	psh.pszCaption	= NULL;
	psh.nPages		= nNumPages;
	psh.nStartPage	= 0;
	psh.ppsp		= psp;
	psh.pfnCallback	= NULL;

	// Display the Property Sheet - doesn't return until OK or Cancel

	PropertySheet(&psh);

	if (!(pConfig->bCancel) && !(pConfig->bApplied))
		pConfig->bSave = TRUE;

	return;
}


void SaveAdminOptions(pgpConfigInfo *pConfig)
{
	PGPPrefRef		prefRef;
	PGPPrefArray *	prefArray;
	PGPUInt32		index;
	PGPKeyDBObjRef	sigCA;

	prefRef = pConfig->prefRef;

	PGPSetPrefBoolean(prefRef, kPGPPrefUseOutgoingADK, 
		pConfig->bUseOutgoingADK);
	PGPSetPrefBoolean(prefRef, kPGPPrefUseDHADK, 
		pConfig->bUseIncomingADK);
	PGPSetPrefBoolean(prefRef, kPGPPrefUsePGPdiskADK, 
		pConfig->bUseDiskADK);
	PGPSetPrefBoolean(prefRef, kPGPPrefEnforceIncomingADK, 
		pConfig->bEnforceIncomingADK);
	PGPSetPrefBoolean(prefRef, kPGPPrefEnforceOutgoingADK, 
		pConfig->bEnforceOutgoingADK);
	PGPSetPrefBoolean(prefRef, kPGPPrefEnforceRemoteADKClass, 
		pConfig->bEnforceRemoteADK);
	PGPSetPrefBoolean(prefRef, kPGPPrefEnforceMinChars, 
		pConfig->bEnforceMinChars);
	PGPSetPrefBoolean(prefRef, kPGPPrefEnforceMinQuality, 
		pConfig->bEnforceMinQuality);
	PGPSetPrefBoolean(prefRef, kPGPPrefAutoSignTrustCorp,
		pConfig->bAutoSignTrustCorp);
	PGPSetPrefBoolean(prefRef, kPGPPrefMetaIntroducerCorp,
		pConfig->bMetaIntroducerCorp);
	PGPSetPrefBoolean(prefRef, kPGPPrefAllowKeyGeneration,
		pConfig->bAllowKeyGen);
	PGPSetPrefBoolean(prefRef, kPGPPrefPresetKeyGeneration,
		pConfig->bSetKeyGen);
	PGPSetPrefBoolean(prefRef, kPGPPrefGenerateKeysOnSmartCard,
		pConfig->bUseSmartCard);
	PGPSetPrefBoolean(prefRef, kPGPPrefAllowConventionalEncryption,
		pConfig->bAllowConventionalEncryption);
	PGPSetPrefBoolean(prefRef, kPGPPrefAllowEncryptInvalidKeys,
		pConfig->bAllowEncryptInvalidKeys);
	PGPSetPrefBoolean(prefRef, kPGPPrefAllowKeySigning,
		pConfig->bAllowKeySigning);
	PGPSetPrefBoolean(prefRef, kPGPPrefAutoAddExchangeServerAddress,
		pConfig->bAutoAddExchangeServerAddress);
	PGPSetPrefBoolean(prefRef, kPGPPrefAddLotusNotesUserID,
		pConfig->bAutoAddLotusNotesAddress);
	PGPSetPrefBoolean(prefRef, kPGPPrefUpdateAllKeys,
		pConfig->bUpdateAllKeys);
	PGPSetPrefBoolean(prefRef, kPGPPrefUpdateTrustedIntroducers,
		pConfig->bUpdateTrustedIntroducers);
	PGPSetPrefBoolean(prefRef, kPGPPrefAutoAddRevoker,
		pConfig->bAutoAddRevoker);
	PGPSetPrefBoolean(prefRef, kPGPPrefKeyGenX509CertRequest,
		pConfig->bKeyGenCertRequest);
	PGPSetPrefBoolean(prefRef, kPGPPrefAllowManualX509CertRequest,
		pConfig->bAllowManualCertRequest);
	PGPSetPrefBoolean(prefRef, kPGPPrefAutoUpdateX509CRL,
		pConfig->bAutoUpdateCRL);
	PGPSetPrefBoolean(prefRef, kPGPPrefUpdatePrefs,
		pConfig->bUpdateAdminPrefs);
	PGPSetPrefBoolean(prefRef, kPGPPrefAlwaysSendKeys,
		pConfig->bAlwaysSendKeys);
	PGPSetPrefBoolean(prefRef, kPGPPrefAutoKeyReconstruction,
		pConfig->bAutoKeyReconstruction);
	PGPSetPrefBoolean(prefRef, kPGPPrefAutoSignRootCAKey,
		pConfig->bAutoSignRootCAKey);
	PGPSetPrefBoolean(prefRef, kPGPPrefCopyClientPrefs, 
		pConfig->bCopyClientPrefs);
	PGPSetPrefBoolean(prefRef, kPGPPrefRemainSilentAfterInstall,
		pConfig->bRemainSilentAfterInstall);
	PGPSetPrefBoolean(prefRef, kPGPPrefPreselectInstall, 
		pConfig->bPreselectInstall);
	PGPSetPrefBoolean(prefRef, kPGPPrefInstallPrograms, 
		pConfig->bInstallPrograms);
	PGPSetPrefBoolean(prefRef, kPGPPrefInstallLogin, 
		pConfig->bInstallLogin);
	PGPSetPrefBoolean(prefRef, kPGPPrefInstallDisk, 
		pConfig->bInstallDisk);
	PGPSetPrefBoolean(prefRef, kPGPPrefInstallEudora, 
		pConfig->bInstallEudora);
	PGPSetPrefBoolean(prefRef, kPGPPrefInstallOutlook, 
		pConfig->bInstallOutlook);
	PGPSetPrefBoolean(prefRef, kPGPPrefInstallOutlookExpress, 
		pConfig->bInstallOutExpress);
	PGPSetPrefBoolean(prefRef, kPGPPrefInstallICQ, 
		pConfig->bInstallICQ);
	PGPSetPrefBoolean(prefRef, kPGPPrefInstallLotusNotes, 
		pConfig->bInstallLotus);
	PGPSetPrefBoolean(prefRef, kPGPPrefInstallGroupwise, 
		pConfig->bInstallGroupwise);
	PGPSetPrefBoolean(prefRef, kPGPPrefInstallDocumentation, 
		pConfig->bInstallManual);
	PGPSetPrefBoolean(prefRef, kPGPPrefUninstallOldPGP, 
		pConfig->bUninstallOld);
	PGPSetPrefBoolean(prefRef, kPGPPrefRebootAfterSilentInstall, 
		pConfig->bAutoReboot);
	
	PGPSetPrefBoolean(prefRef, kPGPPrefDiskCreate, 
		pConfig->bDiskCreate);
	
	PGPSetPrefNumber(prefRef, kPGPPrefMinChars, 
		pConfig->nMinChars);
	PGPSetPrefNumber(prefRef, kPGPPrefMinQuality, 
		pConfig->nMinQuality);
	PGPSetPrefNumber(prefRef, kPGPPrefKeySize, 
		pConfig->nKeySize);
	PGPSetPrefNumber(prefRef, kPGPPrefLDAPReconServerType, 
		pConfig->nReconServerType);
	PGPSetPrefNumber(prefRef, kPGPPrefDaysUpdateAllKeys,
		pConfig->nDaysUpdateAllKeys);
	PGPSetPrefNumber(prefRef, kPGPPrefDaysUpdateTrustedIntroducers,
		pConfig->nDaysUpdateTrustedIntroducers);
	PGPSetPrefNumber(prefRef, kPGPPrefDaysUpdatePrefs,
		pConfig->nDaysUpdatePrefs);
	PGPSetPrefNumber(prefRef, kPGPPrefKeyPublicKeyAlgorithm,
		pConfig->keyType);
	PGPSetPrefNumber(prefRef, kPGPPrefKeyExpiration,
		pConfig->keyExpiration);
	PGPSetPrefNumber(prefRef, kPGPPrefCorpKeyTrustDepth,
		pConfig->nCorpKeyTrustDepth);
	PGPSetPrefNumber(prefRef, kPGPPrefCertRequestType,
		pConfig->nCertRequestType);

	PGPSetPrefNumber(prefRef, kPGPPrefDiskSize,
		pConfig->nDiskSize);
	PGPSetPrefNumber(prefRef, kPGPPrefDiskAlgorithm,
		pConfig->nDiskAlgorithm);
	PGPSetPrefNumber(prefRef, kPGPPrefDiskFileSystem,
		pConfig->nDiskFileSystem);

	if (pConfig->szLDAPServer != NULL)
		PGPSetPrefString(prefRef, kPGPPrefLDAPPrefsServer, 
			pConfig->szLDAPServer);
	else
		PGPSetPrefString(prefRef, kPGPPrefLDAPPrefsServer, "");

	if (pConfig->szReconServer != NULL)
		PGPSetPrefString(prefRef, kPGPPrefLDAPReconServer, 
			pConfig->szReconServer);
	else
		PGPSetPrefString(prefRef, kPGPPrefLDAPReconServer, "");

	if (pConfig->szUserInstallDir != NULL)
		PGPSetPrefString(prefRef, kPGPPrefInstallDir, 
			pConfig->szUserInstallDir);
	else
		PGPSetPrefString(prefRef, kPGPPrefInstallDir, "");

	if (pConfig->bUseOutgoingADK)
		PGPSetPrefData(prefRef, kPGPPrefOutgoingADKID, sizeof(PGPKeyID), 
			pConfig->outgoingADKID.opaqueBytes);
	else
		PGPSetPrefData(prefRef, kPGPPrefOutgoingADKID, 0, NULL);
	
	if (pConfig->bUseIncomingADK)
		PGPSetPrefData(prefRef, kPGPPrefDHADKID, sizeof(PGPKeyID), 
			pConfig->incomingADKID.opaqueBytes);
	else
		PGPSetPrefData(prefRef, kPGPPrefDHADKID, 0, NULL);
	
	if (pConfig->bUseDiskADK)
		PGPSetPrefData(prefRef, kPGPPrefPGPdiskADKKeyID, sizeof(PGPKeyID), 
			pConfig->diskADKID.opaqueBytes);
	else
		PGPSetPrefData(prefRef, kPGPPrefPGPdiskADKKeyID, 0, NULL);
	
	if (pConfig->bAutoSignTrustCorp)
		PGPSetPrefData(prefRef, kPGPPrefCorpKeyID, sizeof(PGPKeyID), 
			pConfig->corpKeyID.opaqueBytes);
	else
		PGPSetPrefData(prefRef, kPGPPrefCorpKeyID, 0, NULL);
	
	if (pConfig->bAutoAddRevoker)
		PGPSetPrefData(prefRef, kPGPPrefRevokerKeyID, sizeof(PGPKeyID), 
			pConfig->revokerKeyID.opaqueBytes);
	else
		PGPSetPrefData(prefRef, kPGPPrefRevokerKeyID, 0, NULL);
	
	// Save the AV list, if specified
	
	PGPSetPrefNumber(prefRef, kPGPPrefCAType, pConfig->nCAType);
	if (pConfig->nCAType != kPGPKeyServerClass_Invalid)
		PGPSetPrefData(prefRef, kPGPPrefExtraAVPairs, pConfig->avDataSize, 
				pConfig->avData);
	
	// See if the root CA key needs to be added to the default keys

	if (IsntPGPError(PGPclGetRootCACertPrefs(pConfig->pgpContext, prefRef,
		pConfig->keyDB, &sigCA)))
	{
		PGPKeyDBObjRef	keyCA;
		PGPKeyID 		caKeyID;
		BOOL bGotCA = FALSE;

		keyCA = PGPPeekKeyDBObjKey(sigCA);
		PGPGetKeyID(keyCA, &caKeyID);
		
		if (pConfig->defaultKeys != NULL)
		{
			for (index=0; index<pConfig->nNumDefaultKeys; index++)
			{
				if (!memcmp(pConfig->defaultKeys[index].opaqueBytes, 
					caKeyID.opaqueBytes, sizeof(PGPKeyID)))
				{
					bGotCA = TRUE;
					break;
				}
			}
		}
		
		if (!bGotCA)
		{
			PGPReallocData(pConfig->memoryMgr, &(pConfig->defaultKeys),
				sizeof(PGPKeyID) * (pConfig->nNumDefaultKeys + 1), 0);
			
			memcpy(pConfig->defaultKeys[pConfig->nNumDefaultKeys].opaqueBytes,
				caKeyID.opaqueBytes, sizeof(PGPKeyID));
			pConfig->nNumDefaultKeys++;
		}
	}

	// Add any ADK's to the default keys

	if (pConfig->bUseDiskADK) 
	{
		BOOL bGotKey = FALSE;

		for (index=0; index<pConfig->nNumDefaultKeys; index++)
		{
			if (!memcmp(pConfig->defaultKeys[index].opaqueBytes, 
				pConfig->diskADKID.opaqueBytes, sizeof(PGPKeyID)))
			{
				bGotKey = TRUE;
				break;
			}
		}

		if (!bGotKey)
		{
			PGPReallocData(pConfig->memoryMgr, &(pConfig->defaultKeys),
				sizeof(PGPKeyID) * (pConfig->nNumDefaultKeys + 1), 0);
			memcpy(pConfig->defaultKeys[pConfig->nNumDefaultKeys].opaqueBytes,
				pConfig->diskADKID.opaqueBytes, sizeof(PGPKeyID));
			pConfig->nNumDefaultKeys++;
		}
	}

	if (pConfig->bUseIncomingADK) 
	{
		BOOL bGotKey = FALSE;

		for (index=0; index<pConfig->nNumDefaultKeys; index++)
		{
			if (!memcmp(pConfig->defaultKeys[index].opaqueBytes, 
				pConfig->incomingADKID.opaqueBytes, sizeof(PGPKeyID)))
			{
				bGotKey = TRUE;
				break;
			}
		}

		if (!bGotKey)
		{
			PGPReallocData(pConfig->memoryMgr, &(pConfig->defaultKeys),

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -