pgpkeys.pas

来自「用DELPHI实现的 PGP 加密算法」· PAS 代码 · 共 1,703 行 · 第 1/5 页

PAS
1,703
字号
  kPGPOpenKeyDBFileOptions_None				= 0;
  kPGPOpenKeyDBFileOptions_Mutable			= (1 shl 0);
  kPGPOpenKeyDBFileOptions_Create			= (1 shl 1);

type
  { Key DB object types for the property kPGPKeyDBObjProperty_ObjectType }
  PGPKeyDBObjType = PGPEnumType;
const
  kPGPKeyDBObjType_Invalid				= 0;
  kPGPKeyDBObjType_Key					= (1 shl 0);
  kPGPKeyDBObjType_SubKey				= (1 shl 1);
  kPGPKeyDBObjType_UserID				= (1 shl 2);
  kPGPKeyDBObjType_Signature				= (1 shl 3);
  kPGPKeyDBObjType_Any					= -1;

// both versions
type
  { Used by Filtering functions to specify type of Match }
  PGPMatchCriterion = PGPEnumType;
const
  kPGPMatchDefault					= 1;
  kPGPMatchEqual					= 1; // val == supplied val
  kPGPMatchGreaterOrEqual				= 2; // val >= supplied val
  kPGPMatchLessOrEqual					= 3; // val <= supplied val
  kPGPMatchSubString					= 4; // val is in supplied val

const
  { This is the value of the Expiration time which means "never expires" }
  kPGPExpirationTime_Never				= 0;

type
    PGPKeyIDStringType = PGPEnumType;
const
  // typed constants because of version specific values
  kPGPKeyIDString_Abbreviated: PGPKeyIDStringType = 0;
  kPGPKeyIDString_Full: PGPKeyIDStringType = 0;

var
  { Key ring management 6.5.X }
  PGPOpenDefaultKeyRings: function(Context: pPGPContext;
		OpenFlags: PGPKeyRingOpenFlags;
		var KeySet: pPGPKeySet): PGPError; cdecl;
  PGPOpenKeyRingPair: function(Context: pPGPContext;
		OpenFlags: PGPKeyRingOpenFlags;
		PubFileSpec: pPGPFileSpec;
		SecFileSpec: pPGPFileSpec;
		var KeySet: pPGPKeySet): PGPError; cdecl;
  PGPOpenKeyRing: function(Context: pPGPContext;
		OpenFlags: PGPKeyRingOpenFlags;
		FileSpec: pPGPFileSpec;
		var KeySet: pPGPKeySet): PGPError; cdecl;
  PGPReloadKeyRings: function(KeySet: pPGPKeySet): PGPError; cdecl;
  PGPKeySetIsMutable: function(KeySet: pPGPKeySet): PGPBoolean; cdecl;
  PGPKeySetNeedsCommit: function(KeySet: pPGPKeySet): PGPBoolean; cdecl;
  PGPCommitKeyRingChanges: function(KeySet: pPGPKeySet): PGPError; cdecl;
  PGPRevertKeyRingChanges: function(KeySet: pPGPKeySet): PGPError; cdecl;
  { Key DB management 7.X }
  PGPNewKeyDB: function(Context: pPGPContext; var KeyDB: pPGPKeyDB): PGPError; cdecl;
  PGPOpenKeyDBFile: function(Context: pPGPContext;
		Options: PGPOpenKeyDBFileOptions;
		PubKeysFileSpec: pPGPFileSpec;
		PrivKeysFileSpec: pPGPFileSpec;
		var KeyDB: pPGPKeyDB): PGPError; cdecl;
  PGPFreeKeyDB: function(KeyDB: pPGPKeyDB): PGPError; cdecl;
  PGPFlushKeyDB: function(KeyDB: pPGPKeyDB): PGPError; cdecl;
  PGPIncKeyDBRefCount: function(KeyDB: pPGPKeyDB): PGPError; cdecl;
  PGPKeyDBIsMutable: function(KeyDB: pPGPKeyDB): PGPBoolean; cdecl;
  PGPKeyDBIsUpdated: function(KeyDB: pPGPKeyDB; var IsUpdated: PGPBoolean): PGPError; cdecl;
  PGPCountKeysInKeyDB: function(KeyDB: pPGPKeyDB; var NumKeys: PGPUInt32): PGPError; cdecl;
  PGPPeekKeyDBRootKeySet: function(KeyDB: pPGPKeyDB): pPGPKeySet; cdecl;
  PGPPeekKeySetKeyDB: function(KeySet: pPGPKeySet): pPGPKeyDB; cdecl;

  { Keyset management }
  // PGP 6.5.X
  PGPNewKeySet: function(Context: pPGPContext;
		var KeySet: pPGPKeySet): PGPError; cdecl;
  // PGP 7.X
  {PGPNewKeySet: function(KeyDB: pPGPKeyDB;
		var KeySet: pPGPKeySet): PGPError; cdecl;}
  // PGP 6.5.X
  PGPNewEmptyKeySet: function(OrigSet: pPGPKeySet;
		var NewSet: pPGPKeySet): PGPError; cdecl;
  // PGP 7.X
  {PGPNewEmptyKeySet: function(KeyDB: pPGPKeyDB;
		var NewSet: pPGPKeySet): PGPError; cdecl;}
  // PGP 6.5.X
  PGPNewSingletonKeySet: function(Key: pPGPKey;
		var KeySet: pPGPKeySet): PGPError; cdecl;
  // PGP 7.X
  PGPNewOneKeySet: function(KeyDBObj: pPGPKeyDBObj;
		var KeySet: pPGPKeySet): PGPError; cdecl;
  // both
  PGPIncKeySetRefCount: function(KeySet: pPGPKeySet): PGPError; cdecl;
  // both
  PGPFreeKeySet: function(KeySet: pPGPKeySet): PGPError; cdecl;
  // PGP 6.5.X
  PGPImportKeySet: function(Context: pPGPContext;
		var KeySet: pPGPKeySet;
		Options: pPGPOptionList;
		LastOption: pPGPOptionList): PGPError; cdecl;
  // PGP 7.X
  PGPImport: function(Context: pPGPContext; var ImportedKeys: pPGPKeyDB;
		Options: pPGPOptionList;
		LastOption: pPGPOptionList): PGPError; cdecl;
  // PGP 6.5.X
  PGPExportKeySet: function(KeySet: pPGPKeySet;
		Options: pPGPOptionList;
		LastOption: pPGPOptionList): PGPError; cdecl;
  // PGP 7.X
  PGPExport: function(Context: pPGPContext;
		Options: pPGPOptionList;
		LastOption: pPGPOptionList): PGPError; cdecl;
  // both
  PGPAddKeys: function(KeysToAdd: pPGPKeySet;
		ASet: pPGPKeySet): PGPError; cdecl;
  // PGP 7.X
  PGPCopyKeys: function(KeySet: pPGPKeySet; DestKeyDB: pPGPKeyDB;
		 var DestKeySet: pPGPKeySet): PGPError; cdecl;
  // PGP 6.5.X
  PGPRemoveKeys6: function(KeysToRemove: pPGPKeySet;
		ASet: pPGPKeySet): PGPError; cdecl;
  // PGP 7.X
  PGPDeleteKeys7: function(KeysToDelete: pPGPKeySet): PGPError; cdecl;
  // both
  PGPCountKeys: function(KeySet: pPGPKeySet;
		var NumKeys: PGPUInt32): PGPError; cdecl;
  // PGP 6.5.X
  PGPKeySetIsMember: function(Key: pPGPKey;
		KeySet: pPGPKeySet): PGPBoolean; cdecl;
  // PGP 7.X
  {PGPKeySetIsMember: function(KeyDBObj: pPGPKeyDBObj;
		KeySet: pPGPKeySet): PGPBoolean; cdecl;}

  { Key filter functions 6.5.X }
  PGPNewKeyBooleanFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewKeyCreationTimeFilter: function(Context: pPGPContext;
		CreationTime: PGPTime;
		Match: PGPMatchCriterion;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewKeyExpirationTimeFilter: function(Context: pPGPContext;
		ExpirationTime: PGPTime;
		Match: PGPMatchCriterion;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewKeyDisabledFilter: function(Context: pPGPContext;
		Disabled: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewKeyNumberFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		Value: PGPUInt32;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewKeyTimeFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		Value: PGPTime;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewKeyPropertyBufferFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		var Buffer: Pointer;
		Length: PGPSize;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewKeyRevokedFilter: function(Context: pPGPContext;
		Revoked: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewKeyEncryptAlgorithmFilter: function(Context: pPGPContext;
		EncryptAlgorithm: PGPPublicKeyAlgorithm;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewKeyEncryptKeySizeFilter: function(Context: pPGPContext;
		KeySize: PGPUInt32;
		Match: PGPMatchCriterion;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewKeyFingerPrintFilter: function(Context: pPGPContext;
		FingerPrint: Pointer;
		FingerPrintLength: PGPSize;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewKeyIDFilter: function(Context: pPGPContext;
		var PGPKeyID: TPGPKeyID7;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewSubKeyBooleanFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewSubKeyIDFilter: function(Context: pPGPContext;
		var SubPGPKeyID: TPGPKeyID7;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewSubKeyNumberFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		Value: PGPUInt32;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewSubKeyTimeFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		Value: PGPTime;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewSubKeyPropertyBufferFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		var Buffer: Pointer;
		Length: PGPSize;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewKeySigAlgorithmFilter: function(Context: pPGPContext;
		SigAlgorithm: PGPPublicKeyAlgorithm;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewKeySigKeySizeFilter: function(Context: pPGPContext;
		KeySize: PGPUInt32;
		Match: PGPMatchCriterion;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewSigBooleanFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewSigKeyIDFilter: function(Context: pPGPContext;
		var PGPKeyID: TPGPKeyID7;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewSigNumberFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		Value: PGPUInt32;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewSigTimeFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		Value: PGPTime;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewSigPropertyBufferFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		var Buffer: Pointer;
		Length: PGPSize;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewUserIDBooleanFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewUserIDNameFilter: function(Context: pPGPContext;
		NameString: PChar;
		Match: PGPMatchCriterion;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewUserIDNumberFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		Value: PGPUInt32;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewUserIDStringBufferFilter: function(Context: pPGPContext;
		Prop: PGPKeyPropName;
		var Buffer: Pointer;
		Length: PGPSize;
		Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewUserIDStringFilter: function(Context: pPGPContext;
		UserIDString: PChar;
		Match: PGPMatchCriterion;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPNewUserIDEmailFilter: function(Context: pPGPContext;
		EmailString: PChar;
		Match: PGPMatchCriterion;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  { Key filter functions 7.X }
  PGPNewKeyDBObjBooleanFilter7: function(Context: pPGPContext;
		WhichProperty: PGPKeyDBObjProperty; Match: PGPBoolean;
		var OutFilter: pPGPFilter): PGPError; cdecl;

  PGPNewKeyDBObjNumericFilter7: function(Context: pPGPContext;
		WhichProperty: PGPKeyDBObjProperty; MatchValue: PGPUInt32;
		MatchCriteria: PGPMatchCriterion; var OutFilter: pPGPFilter): PGPError; cdecl;

  PGPNewKeyDBObjTimeFilter7: function(Context: pPGPContext;
		WhichProperty: PGPKeyDBObjProperty; MatchValue: PGPTime;
		MatchCriteria: PGPMatchCriterion; var OutFilter: pPGPFilter): PGPError; cdecl;

  PGPNewKeyDBObjDataFilter7: function(Context: pPGPContext;
		WhichProperty: PGPKeyDBObjProperty; const MatchData: Pointer;
		MatchDataSize: PGPSize; MatchCriteria: PGPMatchCriterion;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  { Key filter functions both }
  // freeing OutFilter will call PGPFreeFilter on all Filters
  PGPIncFilterRefCount: function(Filter: pPGPFilter): PGPError; cdecl;
  PGPNegateFilter: function(Filter: pPGPFilter;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPIntersectFilters: function(Filter1: pPGPFilter;
		Filter2: pPGPFilter;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPUnionFilters: function(Filter1: pPGPFilter;
		Filter2: pPGPFilter;
		var OutFilter: pPGPFilter): PGPError; cdecl;
  PGPFreeFilter: function(Filter: pPGPFilter): PGPError; cdecl;
  PGPFilterKeySet: function(OrigSet: pPGPKeySet;
		Filter: pPGPFilter;
		var ResultSet: pPGPKeySet): PGPError; cdecl;

  { Key iteration functions }
  // PGP 6.5.X
  PGPOrderKeySet6: function(KeySet: pPGPKeySet;
		Order: PGPKeyOrdering;
		var KeyList: pPGPKeyList): PGPError; cdecl;
  // PGP 7.X
  PGPOrderKeySet7: function(KeySet: pPGPKeySet;
		Order: PGPKeyOrdering; ReverseOrder: PGPBoolean;
		var KeyList: pPGPKeyList): PGPError; cdecl;
  // both
  PGPIncKeyListRefCount: function(KeyList: pPGPKeyList): PGPError; cdecl;
  // both
  PGPFreeKeyList: function(KeyList: pPGPKeyList): PGPError; cdecl;
  // both
  PGPNewKeyIter: function(KeyList: pPGPKeyList;
		var OutRef: pPGPKeyIter): PGPError; cdecl;
  // PGP 7.X
  PGPNewKeyIterFromKeySet: function(KeySet: pPGPKeySet;
  		var OutRef: pPGPKeyIter): PGPError; cdecl;
  // PGP 7.X
  PGPNewKeyIterFromKeyDB: function(KeyDB: pPGPKeyDB;
		var OutRef: pPGPKeyIter): PGPError; cdecl;
  // both
  PGPCopyKeyIter: function(OrigIter: pPGPKeyIter;
		var CopyIter: pPGPKeyIter): PGPError; cdecl;
  // both
  PGPFreeKeyIter: function(Iter: pPGPKeyIter): PGPError; cdecl;
  // both
  PGPKeyIterIndex: function(Iter: pPGPKeyIter): PGPInt32; cdecl;
  // PGP 6.5.X
  PGPKeyIterKey: function(Iter: pPGPKeyIter;
		var OutRef: pPGPKey): PGPError; cdecl;
  // PGP 6.5.X
  PGPKeyIterSubKey: function(Iter: pPGPKeyIter;
		var OutRef: pPGPSubKey): PGPError; cdecl;
  // PGP 6.5.X
  PGPKeyIterUserID: function(Iter: pPGPKeyIter;
		var OutRef: pPGPUserID): PGPError; cdecl;
  // PGP 6.5.X
  PGPKeyIterSig: function(Iter: pPGPKeyIter;
		var OutRef: pPGPSig): PGPError; cdecl;
  // PGP 7.X
  PGPKeyIterGetKeyDBObj: function(Iter: pPGPKeyIter;
		ObjectType: PGPKeyDBObjType; var OutRef: pPGPKey): PGPError; cdecl;
  // both
  PGPKeyIterMove: function(Iter: pPGPKeyIter;

⌨️ 快捷键说明

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