📄 cpgpkeyjoiner.cpp
字号:
/*____________________________________________________________________________
Copyright (C) 2002 PGP Corporation
All rights reserved.
$Id: CPGPKeyJoiner.cpp,v 1.4 2002/08/06 20:09:23 dallen Exp $
____________________________________________________________________________*/
#include "pgpClassesConfig.h"
#include "CArray.h"
#include "CSecureString.h"
#include "pgpClientLib.h"
#include "CPGPContext.h"
#include "CPGPData.h"
#include "CPGPdiskEngine.h"
#include "CPGPKeyDB.h"
#include "CPGPtlsContext.h"
#include "UCommonStrings.h"
#include "CPGPKeyJoiner.h"
#include "CPGPKeyPicker.h"
_USING_PGP
// Class CPGPKeyJoiner public member functions
void
CPGPKeyJoiner::AskForJoinedKey(
const CPGPdiskContext& context,
HWND parentWnd,
const CPGPKeySet& splitKeys,
CPGPKey& splitKey,
CSecureString& secPassphrase,
PGPByte **ppPassphrase,
PGPUInt32 *plength)
{
pgpAssert(IsWindow(parentWnd));
CPGPContext pgpContext(context.PGPContext());
CPGPKeyList splitKeysList(splitKeys, kPGPKeyOrdering_Any);
CPGPKeyIter splitKeysIter(splitKeysList);
if (splitKeys.Count() > 1)
{
using namespace UCommonStrings;
// Ask user to choose from split keys.
CPGPKeyPicker keyPickerDlg;
CPGPKeySet pickedKeys;
pickedKeys.CreateEmpty(splitKeys.KeyDB());
keyPickerDlg.Display(context, parentWnd, Get(kKeyJoinerDialogTitle),
Get(kKeyJoinerDialogMessage), splitKeys, pickedKeys, TRUE);
// Return picked key.
pgpAssert(pickedKeys.Count() == 1);
CPGPKeyList pickedKeysList(pickedKeys, kPGPKeyOrdering_Any);
CPGPKeyIter pickedKeysIter(pickedKeysList);
pickedKeysIter.Next(splitKey);
}
else if (splitKeys.Count() == 1)
{
splitKeysIter.Next(splitKey);
}
else
{
THROW_PGPERROR(kPGPError_BadParams);
}
pgpAssert(splitKey.GetBooleanProp(kPGPKeyProperty_IsSecretShared));
// Ask to join key.
CPGPKeySet pgpKeys(context.PGPKeyDB());
CPGPtlsContext tlsContext(pgpContext);
// PGPByte *pPassphrase;
// PGPUInt32 length;
PGPError pgpErr = PGPclReconstituteKey(pgpContext, tlsContext,
parentWnd, pgpKeys.KeyDB(), splitKey, ppPassphrase, plength);
THROW_IF_PGPERROR(pgpErr);
// CPGPData passphrase(pPassphrase, length, TRUE);
// secPassphrase.Assign(static_cast<const char *>(passphrase.Get()));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -