📄 pgpkeydb.h
字号:
/*
* pgpKeyDB.h -- Public definitions for PGP KeyDB Library
*
* Copyright (C) 1996,1997 Pretty Good Privacy, Inc. All rights reserved.
*
* $Id: pgpKeyDB.h,v 1.72.2.12.2.2 1997/07/08 02:24:14 mhw Exp $
*/
#ifndef PGPKEYDB_H
#define PGPKEYDB_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import on
#endif
#include <time.h>
#include "pgpDebug.h"
#include "pgpTypes.h"
#include "pgpUsuals.h"
#include "pgpErr.h"
#include "pgpFileRef.h"
#include "pgpRngPub.h"
#include "pgpPubKey.h"
#include "pgpRndPool.h"
#include "pgpTrstPkt.h"
#include "pgpTrust.h"
#include "pgpHash.h"
#include "pgpTimeDate.h"
#ifndef TYPE_PGPKEYDB
#define TYPE_PGPKEYDB
typedef struct PGPKeyDB_ PGPKeyDB;
#endif
#ifndef TYPE_PGPKEY
#define TYPE_PGPKEY
typedef struct PGPKey_ PGPKey;
#endif
#ifndef TYPE_PGPSUBKEY
#define TYPE_PGPSUBKEY
typedef struct PGPSubKey_ PGPSubKey;
#endif
#ifndef TYPE_PGPUSERID
#define TYPE_PGPUSERID
typedef struct PGPUserID_ PGPUserID;
#endif
#ifndef TYPE_PGPCERT
#define TYPE_PGPCERT
typedef struct PGPCert_ PGPCert;
#endif
#ifndef TYPE_PGPKEYSET
#define TYPE_PGPKEYSET
typedef struct PGPKeySet_ PGPKeySet;
#endif
#ifndef TYPE_PGPKEYLIST
#define TYPE_PGPKEYLIST
typedef struct PGPKeyList_ PGPKeyList;
#endif
#ifndef TYPE_PGPKEYITER
#define TYPE_PGPKEYITER
typedef struct PGPKeyIter_ PGPKeyIter;
#endif
/* Key ordering */
typedef enum PGPKeyOrdering {
kPGPAnyOrdering = 1,
kPGPUserIDOrdering,
kPGPReverseUserIDOrdering,
kPGPKeyIDOrdering,
kPGPReverseKeyIDOrdering,
kPGPValidityOrdering,
kPGPReverseValidityOrdering,
kPGPTrustOrdering,
kPGPReverseTrustOrdering,
kPGPKeySizeOrdering,
kPGPReverseKeySizeOrdering,
kPGPCreationOrdering,
kPGPReverseCreationOrdering
} PGPKeyOrdering;
/* Key and UserID validity values for kPGPKeyPropValidity and
kPGPUserIDPropValidity properties. */
#define PGP_VALIDITY_UNKNOWN PGP_NAMETRUST_UNKNOWN
#define PGP_VALIDITY_INVALID PGP_NAMETRUST_UNTRUSTED
#define PGP_VALIDITY_MARGINAL PGP_NAMETRUST_MARGINAL
#define PGP_VALIDITY_COMPLETE PGP_NAMETRUST_COMPLETE
#define PGP_VALIDITY_UNTRUSTED PGP_VALIDITY_INVALID
/* Key properties */
typedef enum {
/* String properties */
kPGPKeyPropKeyId = 10,
kPGPKeyPropFingerprint,
/* Number properties */
kPGPKeyPropAlgId,
kPGPKeyPropBits,
kPGPKeyPropTrust, /* old trust model only */
kPGPKeyPropTrustVal = kPGPKeyPropTrust,
kPGPKeyPropValidity, /* both trust models */
/* Time properties */
kPGPKeyPropCreation,
kPGPKeyPropExpiration,
/* Boolean properties */
kPGPKeyPropIsSecret,
kPGPKeyPropIsAxiomatic,
kPGPKeyPropIsRevoked,
kPGPKeyPropIsDisabled,
kPGPKeyPropIsNotCorrupt,
kPGPKeyPropIsValid = kPGPKeyPropIsNotCorrupt,
kPGPKeyPropIsExpired,
kPGPKeyPropNeedsPassphrase,
kPGPKeyPropCanSign,
kPGPKeyPropCanEncrypt
} PGPKeyPropName;
/* User ID properties */
typedef enum {
/* String properties */
kPGPUserIDPropName = 30,
/* Number properties */
kPGPUserIDPropValidity, /* both trust models */
kPGPUserIDPropTrustVal = kPGPUserIDPropValidity,
kPGPUserIDPropConfidence /* new trust model only */
/* Time properties */
/* Boolean properties */
} PGPUserIDPropName;
/* Certificate properties */
typedef enum {
/* String properties */
kPGPCertPropKeyID = 50,
/* Number properties */
/* Time properties */
kPGPCertPropCreation,
/* Boolean properties */
kPGPCertPropIsRevoked,
kPGPCertPropIsNotCorrupt,
kPGPCertPropIsValid = kPGPCertPropIsNotCorrupt,
kPGPCertPropIsTried,
kPGPCertPropIsVerified,
kPGPCertPropIsChecked = kPGPCertPropIsVerified,
kPGPCertPropIsMyCert
} PGPCertPropName;
/*
* Note on kPGPCertPropIsMyCert. This is a convenience property for
* determining whether the certification was made by one of the
* caller's own private keys. This can only return true if the
* signing key is in the same base keyset as the certification. If the
* signing key is (suspected to be) in a different base keyset, call
* pgpGetCertifier (certset, signerset, &key) followed by
* pgpGetKeyBoolean (key, kPGPKeyPropIsSecret, &secret).
*/
/*
* Typedefs for preference file access
*
* WARNING:
* Note that pgpPrefsInt.h, pgpPrefMac.c and pgpPrefXXX.c must
* be updated if these change.
*
* Also, always add new preferences to the end!!!
*/
typedef enum PGPPrefNameNumber_ {
kPGPPrefNumFirst = 100,
kPGPPrefVersion = kPGPPrefNumFirst,
kPGPPrefCipherNum,
kPGPPrefHashNum,
kPGPPrefCompressNum,
kPGPPrefArmorLines,
kPGPPrefCertDepth,
kPGPPrefCompressQual,
kPGPPrefMailWordWrapWidth,
kPGPPrefMailPassCacheDuration, /* seconds */
kPGPPrefSignCacheDuration, /* seconds */
kPGPPrefDateOfLastSplashScreen, /* PGPTime */
kPGPPrefHTTPKeyServerPort,
kPGPPrefNumLast
} PGPPrefNameNumber;
typedef enum PGPPrefNameString_ {
kPGPPrefStrFirst = 200,
kPGPPrefUserID = kPGPPrefStrFirst,
kPGPPrefPubRing,
kPGPPrefPrivRing,
kPGPPrefRandomDevice,
kPGPPrefRandSeed,
kPGPPrefLanguage,
kPGPPrefOwnerName,
kPGPPrefCompanyName,
kPGPPrefLicenseNumber,
kPGPPrefHTTPKeyServerHost,
kPGPPrefLanguageFile,
kPGPPrefStrLast
} PGPPrefNameString;
typedef enum PGPPrefNameBoolean_ {
kPGPPrefBoolFirst = 300,
kPGPPrefArmor = kPGPPrefBoolFirst,
kPGPPrefEncryptToSelf,
kPGPPrefCompress,
kPGPPrefMailWordWrapEnable,
kPGPPrefMailPassCacheEnable,
kPGPPrefMailEncryptPGPMIME,
kPGPPrefMailSignPGPMIME,
kPGPPrefFastKeyGen,
kPGPPrefSignCacheEnable,
kPGPPrefWarnOnMixRSAElGamal,
kPGPPrefMailEncryptDefault,
kPGPPrefMailSignDefault,
kPGPPrefMarginallyValidWarning,
kPGPPrefFirstKeyGenerated,
kPGPPrefWarnOnRSARecipAndNonRSASigner,
kPGPPrefBoolLast
} PGPPrefNameBoolean;
typedef enum PGPPrefNameData_ {
kPGPPrefDataFirst = 400,
kPGPPrefPubRingRef = kPGPPrefDataFirst,
kPGPPrefPrivRingRef,
kPGPPrefRandSeedData,
kPGPPrefPGPkeysMacMainWinPos,
kPGPPrefPGPappMacPrivateData,
kPGPPrefPGPmenuMacAppSignatures,
kPGPPrefDataLast
} PGPPrefNameData;
/* Public entry points */
#ifdef __cplusplus
extern "C" {
#endif
/* Library initialization and cleanup */
PGPError PGPKDBExport
pgpLibInit (void);
void PGPKDBExport
pgpLibCleanup (void);
Boolean PGPKDBExport
pgpOpenSemaphore (void);
void PGPKDBExport
pgpCloseSemaphore (void);
/* KeySet manipulations */
PGPKeySet PGPKDBExport *
pgpNewKeySet (void);
PGPKeySet PGPKDBExport *
pgpNewSingletonKeySet (PGPKey *key);
PGPKeySet PGPKDBExport *
pgpCopyKeySet (PGPKeySet *orig);
PGPKeySet PGPKDBExport *
pgpFilterKeySetUserID (PGPKeySet *origset, char const *name, size_t namelen);
PGPKeySet PGPKDBExport *
pgpFilterKeySetKeyID (PGPKeySet *origset, byte const *keyID,
size_t keyIDLength);
PGPKeySet PGPKDBExport *
pgpFilterKeySetAuto (PGPKeySet *origset, char const *pattern);
PGPKeySet PGPKDBExport *
pgpOpenDefaultKeyRings (Boolean isMutable, PGPError *errorPtr);
PGPKeySet PGPKDBExport *
pgpOpenKeyRingPair (Boolean isMutable, PGPFileRef *pubFileRef,
PGPFileRef *secFileRef, PGPError *errorPtr);
PGPKeySet PGPKDBExport *
pgpOpenKeyRing (Boolean isMutable, Boolean isPrivate, Boolean isTrusted,
PGPFileRef *fileRef, PGPError *errorPtr);
PGPError PGPKDBExport
pgpCommitKeyRingChanges (PGPKeySet *keys);
PGPError PGPKDBExport
pgpRevertKeyRingChanges (PGPKeySet *keys);
PGPError PGPKDBExport
pgpCheckKeyRingCertificates (PGPKeySet *keys);
PGPError PGPKDBExport
pgpReloadKeyRings (PGPKeySet *keys);
PGPKeySet PGPKDBExport *
pgpUnionKeySets (PGPKeySet *a, PGPKeySet *b);
PGPKey PGPKDBExport *
pgpGetKeyByKeyID (PGPKeySet *keys, byte *keyID, size_t keyIDLength);
Boolean PGPKDBExport
pgpKeySetMember(PGPKeySet *set, PGPKey *key);
long PGPKDBExport
pgpCountKeys (PGPKeySet *keys);
void PGPKDBExport
pgpIncKeySetRefCount (PGPKeySet *keys);
void PGPKDBExport
pgpFreeKeySet (PGPKeySet *keys);
Boolean PGPKDBExport
pgpKeySetIsMutable (PGPKeySet *keys);
Boolean PGPKDBExport
pgpKeySetIsDirty (PGPKeySet *keys);
PGPKeySet PGPKDBExport *
pgpImportKeyFile (PGPFileRef *fileRef);
PGPKeySet PGPKDBExport *
pgpImportKeyBuffer (byte *buffer, size_t length);
PGPError PGPKDBExport
pgpExportKeyFile (PGPKeySet *keys, PGPFileRef *fileRef);
PGPError PGPKDBExport
pgpExportKeyBuffer (PGPKeySet *keys, byte *buffer, size_t *length);
PGPError PGPKDBExport
pgpIncKeyRefCount (PGPKey *key);
PGPError PGPKDBExport
pgpFreeKey (PGPKey *key);
PGPError PGPKDBExport
pgpAddKeys (PGPKeySet *set, PGPKeySet *keysToAdd);
PGPError PGPKDBExport
pgpRemoveKeys (PGPKeySet *set, PGPKeySet *keysToRemove);
/* Key manipulation functions */
PGPError PGPKDBExport
pgpRevokeKey (PGPKey *key, char *passphrase);
unsigned PGPKDBExport
pgpQueryEntropyNeeded (byte pkalg, unsigned bits);
unsigned PGPKDBExport
pgpKeyEntropyNeeded (byte pkalg, unsigned bits);
PGPError PGPKDBExport
pgpAddRandomBits (byte *random_bits, unsigned num_bytes);
PGPError PGPKDBExport
pgpGenerateKey (PGPKeySet *keyset, byte pkalg, unsigned bits,
word16 expiration, char *name, int nameLen, char *passphrase,
int (*progress) (void *arg, int phase), void *arg,
PGPKey **key);
PGPError PGPKDBExport
pgpGenerateSubKey (PGPKey *masterkey, unsigned bits, word16 expiration,
char *passphrase, char *masterkeyphrase,
int (*progress) (void *arg, int phase), void *arg);
PGPError PGPKDBExport
pgpDisableKey (PGPKey *key);
PGPError PGPKDBExport
pgpEnableKey (PGPKey *key);
PGPError PGPKDBExport
pgpChangePassphrase (PGPKey *key, char *oldphrase, char *newphrase);
PGPError PGPKDBExport
pgpChangeSubKeyPassphrase (PGPSubKey *subkey,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -