📄 pgpcl.pas
字号:
{$J+,Z4}
unit pgpCL;
{**********************************************************************************}
{ }
{ The contents of this file are subject to the Mozilla Public License Version 1.1 }
{ (the "License"); you may not use this file except in compliance with the }
{ License. You may obtain a copy of the License at http://www.mozilla.org/MPL/. }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the }
{ specific language governing rights and limitations under the License. }
{ }
{ The Original Code is the "Borland Delphi Runtime Library PGPsdk" released 10 Apr }
{ 2000, available at http://www.oz.net/~srheller/dpgp/sdk/. }
{ }
{ The Initial Developer of the Original Code is Steven R. Heller. }
{ }
{ Portions created by Steven R. Heller are Copyright (C) 2000 Steven R. Heller. }
{ All Rights Reserved. }
{ }
{ Contributor(s): Michael in der Wiesche <idw.doc@t-online.de> ("idw"). }
{ }
{ The original file is pgpClient.pas based on pgpCl.h from the PGP sources }
{ which are Copyright (C) Network Associates Inc. and affiliated companies. }
{ }
{ Modifications by "idw" (other than stated in the code below): }
{ }
{ Lots of stuff removed (especially from PGP versions 5.5.X and 6.0.X) }
{ }
{**********************************************************************************}
interface
uses
Windows,
pgpBase,
pgpPubTypes,
pgpMemoryMgr,
pgpKeyServer,
pgpEvents,
pgpKeys,
pgpTLS;
const // added by idw
WM_PGPReloadPrefs: Longint = 0;
WM_PGPReloadKeyring: Longint = 0;
WM_PGPReloadKeyserverPrefs: Longint = 0;
// _______________________________________________________
//
// from pflPrefs // added by idw
type
PGPPrefIndex = PGPInt32;
// _______________________________________________________
//
// from pgpClientPrefs // added by idw
const
// (enum)
kPGPPrefMacBinaryOff = 1;
kPGPPrefMacBinarySmart = 2;
kPGPPrefMacBinaryOn = 3;
// _PGPClientPrefsBool (enum)
kPGPPrefBoolFirst = 0;
kPGPPrefEncryptToSelf = 0;
kPGPPrefWordWrapEnable = 1;
kPGPPrefDecryptCacheEnable = 2;
kPGPPrefSignCacheEnable = 3;
kPGPPrefMailEncryptPGPMIME = 4;
kPGPPrefMailSignPGPMIME = 5;
kPGPPrefFastKeyGen = 6;
kPGPPrefWarnOnMixRSAElGamal = 7;
kPGPPrefMailEncryptDefault = 8;
kPGPPrefMailSignDefault = 9;
kPGPPrefMarginalIsInvalid = 10;
kPGPPrefDisplayMarginalValidity = 11;
kPGPPrefFirstKeyGenerated = 12;
kPGPPrefWarnOnRSARecipAndNonRSASigner = 13;
kPGPPrefKeyServerSyncUnknownKeys = 14;
kPGPPrefKeyServerSyncOnAdd = 15;
kPGPPrefKeyServerSyncOnKeySign = 16;
kPGPPrefKeyServerSyncOnRevocation = 17;
kPGPPrefWarnOnReadOnlyKeyRings = 18;
kPGPPrefWarnOnWipe = 19;
kPGPPrefAutoDecrypt = 20;
kPGPPrefWarnOnADK = 21;
kPGPPrefKeyServerSyncOnVerify = 22; // 6.0
kPGPPrefPGPkeysMacShowToolbar = 23; // 6.0
kPGPPrefWarnOnMemLockFailure = 24; // 6.0
kPGPPrefExportKeysCompatible = 25; // 6.0
kPGPPrefAlwaysUseSecureViewer = 26; // 6.5
kPGPPrefUseHexFingerprint = 27; // 6.5
kPGPPrefDiskAutoUnmountOnTime = 28; // 7.0
kPGPPrefDiskAutoUnmountOnSleep = 29; // 7.0
kPGPPrefDiskNoSleepIfFailAU = 30; // 7.0
kPGPPrefTrashIntegration = 31; // 6.5
kPGPPrefBoolLast = 31;
// _PGPClientPrefsNumber (enum)
kPGPPrefNumberFirst = 200;
kPGPPrefVersion = 200;
kPGPPrefWordWrapWidth = 201;
kPGPPrefDecryptCacheSeconds = 202;
kPGPPrefSignCacheSeconds = 203;
kPGPPrefDateOfLastSplashScreen = 204; // PGPTime
kPGPPrefPreferredAlgorithm = 205;
kPGPPrefAllowedAlgorithms = 206; // OBSOLETE
kPGPPrefMacBinaryDefault = 207;
kPGPPrefDateOfLastFreewareNotice = 208; // OBSOLETE
kPGPPrefFileWipePasses = 209; // 6.0
kPGPPrefDiskWipePasses = 210; // 6.0
kPGPPrefLastSearchWindowSelection = 211; // 6.0
kPGPPrefLastAllKeysUpdate = 212; // 6.5(moved from admin)
kPGPPrefLastTrustedIntroducersUpdate = 213; // 6.5(moved from admin)
kPGPPrefCAType = 214; // 6.5
kPGPPrefCARootKeyAlg = 215; // 6.5
kPGPPrefCAServerAuthKeyAlg = 216; // 6.5
kPGPPrefCARevocationServerAuthKeyAlg = 217; // 6.5
kPGPPrefNextAutoCRLUpdate = 218; // 6.5
kPGPPrefDiskLastCreateSize = 219; // 7.0
kPGPPrefDiskLastCreateScale = 220; // 7.0
kPGPPrefDiskAutoUnmountTimeout = 221; // 7.0
kPGPPrefNumberLast = 221;
// _PGPClientPrefsString (enum)
kPGPPrefStringFirst = 400;
kPGPPrefOwnerName = 400;
kPGPPrefCompanyName = 401;
kPGPPrefLicenseNumber = 402;
kPGPPrefComment = 403;
kPGPPrefCAServerURL = 405; // 6.5
kPGPPrefCARevocationServerURL = 406; // 6.5
kPGPPrefDiskLastOpenDir = 407; // 7.0
kPGPPrefDiskLastSaveDir = 408; // 7.0
kPGPPrefStringLast = 408;
// _PGPClientPrefsByte (enum)
kPGPPrefByteFirst = 600;
kPGPPrefPGPtoolsMacPrivateData = 600;
kPGPPrefPGPmenuMacAppSignatures = 601;
kPGPPrefPGPkeysMacMainWinPos = 602;
kPGPPrefPGPkeysMacColumnData = 603;
kPGPPrefKeyServerList = 604;
kPGPPrefPGPkeysWinMainWinPos = 605;
kPGPPrefPGPkeysWinColumnData = 606;
kPGPPrefPGPkeysWinGroupsData = 607;
kPGPPrefAllowedAlgorithmsList = 608; // 5.5.1
kPGPPrefPGPdiskWin32PrivateData = 609; // 6.5
kPGPPrefCARootKeyID = 610; // 6.5
kPGPPrefCARootX509IASN = 611; // 6.5
kPGPPrefCAServerAuthKeyID = 612; // 6.5
kPGPPrefCARevocationServerAuthKeyID = 613; // 6.5
kPGPPrefPGPdiskMacPrivateData = 614; // 6.5
kPGPPrefHotKeyData = 615; // 6.5
kPGPPrefByteLast = 615;
// _______________________________________________________
//
// from pgpKeyServerPrefs // added by idw
type
PGPKeyServerEntryFlags = PGPEnumType;
const
kKeyServerListed = 1;
kKeyServerIsRoot = 2;
const
kMaxServerNameLength = 255;
type
TKeyServer = Array[0..kMaxServerNameLength] of Char;
type
pPGPKeyServerEntry = ^TPGPKeyServerEntry;
TPGPKeyServerEntry = Record
StructSize : PGPSize;
Protocol : PGPKeyServerProtocol;
Domain : TKeyServer;
ServerDNS : TKeyServer;
ServerPort : PGPUInt16;
AuthKeyIDString : TKeyID;
AuthAlg : PGPPublicKeyAlgorithm;
Flags : PGPUInt32;
Reserved : Array[0..63] of Char;
end;
// _______________________________________________________
//
// Library Initialization/Cleanup
// Open library and initialize
var
PGPclInitLibrary6: function(Context: pPGPContext): PGPError; cdecl;
PGPclInitLibrary7: function(var Context: pPGPContext; Options: PGPFlags): PGPError; stdcall;
// Close down DLL and purge passphrase buffers.
var
PGPclCloseLibrary6: function: PGPError; cdecl;
PGPclCloseLibrary7: function: PGPError; stdcall;
// _______________________________________________________
//
// Miscellaneous common dialogs and UI elements
// Post PGP preferences property sheets.
//
// This function posts the "PGP Preferences" property
// sheet dialog boxes. Appropriate calls are made into
// the pgpkeydb library to set the preferences.
//
// Entry parameters :
// Context - PGP library context
// hWndParent - handle of parent window
// iStartsheet - zero-based index of property sheet
// page to display initially.
// use the below-defined constants
// keysetMain - main keyset, if available. If not
// available, NULL is OK.
//
// This function returns kPGPError_UserAbort (if the user
// presses the cancel button)
// preferences pages (used for "iStartsheet")
const
PGPCL_GENERALPREFS = 0;
PGPCL_KEYRINGPREFS = 1;
PGPCL_EMAILPREFS = 2;
PGPCL_HOTKEYPREFS = 3;
PGPCL_KEYSERVERPREFS = 4;
PGPCL_CAPREFS = 5;
PGPCL_ADVANCEDPREFS = 6;
PGPCL_PREFPAGES7: Array[PGPCL_GENERALPREFS..PGPCL_ADVANCEDPREFS] of Longint = ($01, $02, $04, $08, $10, $20, $40);
var
PGPclPreferences6: function(Context: pPGPContext; hWndParent: Longint; iStartsheet: Longint; KeySetMain: pPGPKeySet): PGPError; cdecl;
PGPclPreferences7: function(Context: pPGPContext; hWndParent: Longint; iStartsheet: Longint; KeySetMain: pPGPKeySet): PGPError; stdcall;
// ______________________________________________
//
// The following functions are wrappers for
// the pfl prefs routines. These are needed so
// groupwise plugin can access prefs (Delphi)
// using code in the PGPcl DLL // activated by idw
var
PGPclGetPrefBoolean6: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; var Data: PGPBoolean): PGPError; cdecl;
PGPclGetPrefBoolean7: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; var Data: PGPBoolean): PGPError; stdcall;
PGPclSetPrefBoolean6: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; Data: PGPBoolean): PGPError; cdecl;
PGPclSetPrefBoolean7: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; Data: PGPBoolean): PGPError; stdcall;
PGPclGetPrefNumber6: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; var Data: PGPUInt32): PGPError; cdecl;
PGPclGetPrefNumber7: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; var Data: PGPUInt32): PGPError; stdcall;
PGPclSetPrefNumber6: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; Data: PGPUInt32): PGPError; cdecl;
PGPclSetPrefNumber7: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; Data: PGPUInt32): PGPError; stdcall;
PGPclGetPrefStringAlloc6: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; var Str: PChar): PGPError; cdecl;
PGPclGetPrefStringAlloc7: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; var Str: PChar): PGPError; stdcall;
PGPclGetPrefStringBuffer6: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; MaxSize: PGPSize; Str: PChar): PGPError; cdecl;
PGPclGetPrefStringBuffer7: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; MaxSize: PGPSize; Str: PChar): PGPError; stdcall;
PGPclSetPrefString6: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; Str: PChar): PGPError; cdecl;
PGPclSetPrefString7: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex; Str: PChar): PGPError; stdcall;
PGPclGetPrefData6: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex;
var DataLength: PGPSize; var InBuffer: Pointer): PGPError; cdecl;
PGPclGetPrefData7: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex;
var DataLength: PGPSize; var InBuffer: Pointer): PGPError; stdcall;
PGPclSetPrefData6: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex;
DataLength: PGPSize; OutBuffer: Pointer): PGPError; cdecl;
PGPclSetPrefData7: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex;
DataLength: PGPSize; OutBuffer: Pointer): PGPError; stdcall;
PGPclRemovePref6: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex): PGPError; cdecl;
PGPclRemovePref7: function(PGPPref: pPGPPref; PrefIndex: PGPPrefIndex): PGPError; stdcall;
// _______________________________________________________
//
// Preference files convenience functions // activated by idw
// Open client preferences file and returns PrefRef to caller
//
// Entry parameters :
// memMgr - memory manager to user for allocating fileref
// pPrefRef - pointer to buffer to receive PrefRef
var
PGPclOpenClientPrefs6: function(MemMgr: pPGPMemoryMgr; var PGPPref: pPGPPref): PGPError; cdecl;
PGPclOpenClientPrefs7: function(MemMgr: pPGPMemoryMgr; var PGPPref: pPGPPref): PGPError; stdcall;
// Close, and optionally save changes to, open client preference file
//
// Entry parameters :
// PrefRef - PrefRef of file to close
// bSave - TRUE => save changes before closing
var
PGPclCloseClientPrefs6: function(PGPPref: pPGPPref; bSave: Longbool): PGPError; cdecl;
PGPclCloseClientPrefs7: function(PGPPref: pPGPPref; bSave: Longbool): PGPError; stdcall;
// Broadcast message that indicates that the prefs
// have been changed and that others should reload from
// disk.
//
// Entry parameters :
// lParam - 32 value which is passed along as the LPARAM
// of the broadcast message. Current usage
// is to set this to your process ID or your
// window handle so that you can ignore
// your own messages, if you want. Set to
// zero to ensure all recipients process message.
// broadcast message used to inform others of prefs changes
const
RELOADPREFSMSG6 = 'PGPM_RELOADPREFS';
RELOADPREFSMSG7 = 'PGP Prefs Reload';
var
PGPclNotifyPrefsChanges6: procedure(lParam: Longint); cdecl;
PGPclNotifyPrefsChanges7: procedure(lParam: Longint); stdcall;
// Broadcast message that indicates that the keyring
// has been changed and that others should reload from
// disk.
//
// Entry parameters :
// lParam - 32 value which is passed along as the LPARAM
// of the broadcast message. Current usage
// is to set this to your process ID or your
// window handle so that you can ignore
// your own messages, if you want. Set to
// zero to ensure all recipients process message.
// broadcast message used to inform others of keyring changes
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -