📄 pgphandling.c
字号:
&pt_context->pgpUserOptions, ppc_output,
&l_lenOutput, pt_context->f_Encrypt,
pt_context->f_Sign, f_BINARY, FALSE);
if (pl_lenOutput)
*pl_lenOutput = l_lenOutput;
i_error = PGPFreeOptionList( oneTimeOptions);
return i_err ? i_err : i_error;
} //ei_PgpEncodeBuffer(
/** ei_PgpEncodeFile( ***
PGP encode the specified file on the user's file system.
--- parameters & return ----
pt_context: address of the information structure used by the Notes Plug-In to
hold a common set of PGP contextual information through the encoding
process
pc_EXTFILENM_ORIG: address of the string specifying the current extended
filename (path plus filename) of the file to be encoded
pc_EXTFILENM_NEW: address of the string specifying what the extended filename
of the encoded file should be
RETURN: kPGPError_NoErr if successful; the PGP error code otherwise
--- revision history -------
9/16/00 PR: inconsequential signature change
3/20/00 PR: provided standard documentation
12/15/98 PR: created */
PGPError ei_PgpEncodeFile( PgpEncodeContext *const pt_context,
char pc_EXTFILENM_ORIG[],
char pc_EXTFILENM_NEW[]) {
if (!( pt_context && (pt_context->f_Sign || pt_context->f_Encrypt) &&
pc_EXTFILENM_ORIG && pc_EXTFILENM_NEW))
return !kPGPError_NoErr;
//return EncryptSignFile( eh_Instance, /*eh_mainWnd*/ NULL, m_pgpContext,
return EncryptSignFile( eh_Instance, eh_mainWnd, m_pgpContext,
m_pgpTlsContext, mpc_PLUGIN_APP,
mpc_MODULENM, pc_EXTFILENM_ORIG,
&pt_context->t_recipients, NULL,
&pt_context->pgpUserOptions,
pc_EXTFILENM_NEW, pt_context->f_Encrypt,
pt_context->f_Sign, TRUE);
} //ei_PgpEncodeFile(
/** ei_PgpDecodeFile( ***
PGP decode the specified file on the user's file system.
--- parameters & return ----
PC: address of the string specifying the extended filename (path plus
filename) of the file to be decoded
ppc: Output. Pointer to the address of the string in which to store the name
of the decoded file.
RETURN: kPGPError_NoErr if successful; the PGP error code otherwise
--- revision history -------
9/16/00 PR: created */
PGPError ei_PgpDecodeFile( char PC[],
char * *const ppc) {
BOOL f_dmy;
if (!( PC && ppc))
return !kPGPError_NoErr;
return DecryptVerifyFile( eh_Instance, eh_mainWnd, m_pgpContext,
m_pgpTlsContext, mpc_PLUGIN_APP,
mpc_MODULENM, PC, FALSE, TRUE,
ppc, NULL, NULL, &f_dmy);
} //ei_PgpDecodeFile(
/** ei_PgpWipeFile( ***
PGP safe erase (wipe) the specified file from the user's file system,
indicating the result in PGP-error format.
--- parameter & return ----
PC: address of the string specifying the extended filename (path plus
filename) of the file to be wiped
RETURN: kPGPError_NoErr if successful; !kPGPError_NoErr code otherwise
--- revision history ------
9/16/00 PR: created */
PGPError ei_PgpWipeFile( char PC[]) {
FILELIST * pt = NULL;
if (!PC)
return !kPGPError_NoErr;
PGPscAddToFileList( &pt, PC, NULL, NULL);
return PGPscWipeFileList( eh_mainWnd, m_pgpContext, pt, WIPE_DONOTWARN |
WIPE_DONOTPROGRESS, (ULONG) NULL) ?
kPGPError_NoErr : !kPGPError_NoErr;
} //ei_PgpWipeFile(
/** xs_PgpWipeFile( ***
If not already OS locked, PGP safe erase (wipe) the specified file from the
user's file system, indicating result in a LotusScript compatible format.
--- parameter & return ----
PC: address of the string specifying the extended filename (path plus
filename) of the file to be wiped
RETURN:
kPGPError_NoErr if successful
eus_ERR_INVLD_ARG if parameter passed is obviously invalid
errno if specified file does not exist or is locked for writing
PGP error code if unanticipated error occurs, cast to a short
--- revision history ------
9/16/00 PR: created */
short xs_PgpWipeFile( char PC[]) {
int i_err;
if (!PC)
return eus_ERR_INVLD_ARG;
if (i_err = ei_FileAccess( PC, ei_FILE_ACCS_READWRITE, TRUE))
return i_err;
return ei_PgpWipeFile( PC);
} //xs_PgpWipeFile(
/** ei_SetUpPgpEncodeContext( ***
Purpose is to initialize a Notes Plug-In information structure for use in
ensuing PGP encodings.
--- parameters & return ----
f_SIGN: flag telling whether content is to be signed when encoded
f_ENCRYPT: flag telling whether content is to be encrypted when encoded
pt_context: Output. Address of information structure used by the
Notes Plug-In to hold a common set of PGP contextual information through
multiple encoding processes the plug-in may choose to engage.
pf_SyncUnknownKeys: Output. Pointer to the variable in which to store whether
the user wishes PGP to attempt to find unknown keys via a search of
certificate servers listed in her preferences. Relevant only when
encryption is involved. Ignored if omitted.
RETURN: kPGPError_NoErr if successful; the PGP error code otherwise
--- revision history -------
3/20/00 PR
+ adjustment to support PGP 7.0
+ documentation adjustment
9/12/99 PR
+ split out encryption-key resolution into ei_ResolveEncryptionKeys()
+ completed header documentation
12/7/98 PR: created */
PGPError ei_SetUpPgpEncodeContext( const BOOL f_SIGN,
const BOOL f_ENCRYPT,
PgpEncodeContext *const pt_context,
BOOL *const pf_SyncUnknownKeys) {
PGPclRecipientDialogStruct * pt_recipients;
PGPError i_err;
if (!( (f_SIGN || f_ENCRYPT) && pt_context))
return !kPGPError_NoErr;
memset( pt_context, (BYTE) NULL, sizeof( PgpEncodeContext));
if (pf_SyncUnknownKeys)
*pf_SyncUnknownKeys = FALSE;
pt_context->pgpUserOptions = kInvalidPGPOptionListRef;
pt_recipients = &pt_context->t_recipients;
if (IsPGPError( i_err = PGPclOpenDefaultKeyrings( m_pgpContext,
kPGPOpenKeyDBFileOptions_Mutable,
&pt_recipients->keydbOriginal))) {
PGPclEncDecErrorBox( eh_mainWnd, i_err);
return i_err;
}
pt_context->f_Sign = f_SIGN;
pt_context->f_Encrypt = f_ENCRYPT;
if (!f_ENCRYPT)
return kPGPError_NoErr;
pt_recipients->context = m_pgpContext;
pt_recipients->tlsContext = m_pgpTlsContext;
pt_recipients->Version = kPGPCurrentRecipVersion;
pt_recipients->hwndParent = eh_mainWnd;
pt_recipients->dwOptions = kPGPclASCIIArmor;
pt_recipients->dwDisableFlags = kPGPclDisableWipeOriginal |
kPGPclDisableASCIIArmor |
kPGPclDisableSelfDecryptingArchive;
pt_recipients->keydbAdded = kInvalidPGPKeyDBRef;
//if necessary, determine whether the user has it set that keys not
// located should be sought via certificate servers she's got specified
if (pf_SyncUnknownKeys) {
PGPPrefRef pgpPrefs;
PGPBoolean f;
if (i_err = PGPclPeekClientLibPrefRefs( &pgpPrefs, NULL))
return i_err;
i_err = PGPclGetPrefBoolean( pgpPrefs,
kPGPPrefKeyServerSyncUnknownKeys, &f);
if (IsntPGPError( i_err))
*pf_SyncUnknownKeys = f;
} //if (pf_SyncUnknownKeys)
return i_err;
} //ei_SetUpPgpEncodeContext(
/** ei_ResolveEncryptionKeys( ***
Obtain, using the standard PGP client infrastructure, the list of encryption
keys for use in ensuing encodings, based upon a set of e-mail addresses.
--- parameters & return ----
ppc_RECPTS: address of a string-array list of the e-mail addresses to be
resolved to encryption keys
ui_RECPTS: the number of e-mail addresses in the ppc_RECPTS list
f_AMBIG: flag telling whether the recipients array contains addresses that were
derived via a prior address-resolution process which encountered ambiguity
vis-
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -