⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pgprngpub.h

📁 vc环境下的pgp源码
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
 * $Id: pgpRngPub.h,v 1.58 1999/05/27 18:43:37 hal Exp $
 */

#ifndef Included_pgpRngPub_h
#define Included_pgpRngPub_h
/* Public */

#include "pgpUsuals.h"
#include "pgpContext.h"		/* for PGPContextRef */

PGP_BEGIN_C_DECLARATIONS

typedef enum {
	PGPTRUST0=0, PGPTRUST1, PGPTRUST2
} PgpTrustModel;

/* Signature subpacket types.  Many of these are not supported yet. */
enum sigsubbyte {
	/* Signature specific properties */
	SIGSUB_VERSION			= 1,
	SIGSUB_CREATION,
	SIGSUB_EXPIRATION,
	SIGSUB_EXPORTABLE,
	SIGSUB_TRUST,
	SIGSUB_REGEXP,
	SIGSUB_REVOCABLE,
	/* Properties of key being self signed */
	SIGSUB_KEY_CAPABILITIES = 8,
	SIGSUB_KEY_EXPIRATION,
	SIGSUB_KEY_ADDITIONAL_RECIPIENT_REQUEST,
	SIGSUB_PREFERRED_ENCRYPTION_ALGS,
	SIGSUB_KEY_REVOCATION_KEY,
	/* Hints to find signer */
	SIGSUB_KEYID			= 16,
	SIGSUB_USERID,
	SIGSUB_URL,
	SIGSUB_FINGER,
	/* Miscellaneous packets */
	SIGSUB_NOTATION			= 20,
	SIGSUB_PREFERRED_HASH_ALGS,
	SIGSUB_PREFERRED_COMPRESSION_ALGS,
	SIGSUB_KEYSERVER_PREFERENCES,
	SIGSUB_PREFERRED_KEYSERVER,
	SIGSUB_PRIMARY_USERID,
	SIGSUB_POLICY_URL,
	SIGSUB_KEYFLAGS,
	SIGSUB_SIGNER_USERID	= 28,
	SIGSUB_REVOCATION_REASON,
	/* 100-110 are for private use */
	/* Reserve 100 for internal Network Associates use */
	SIGSUB_NAI				= 100,
	/* Used internally for unrecognized packet types */
	SIGSUB_UNRECOGNIZED		= 255	/* crit bit is ignored here */
};

/* Critical bit means we must handle this subpacket */
#define SIGSUBF_CRITICAL	0x80

/* Flag bits within SIGSUB_KEYFLAGS */
#define SIGSUBF_KEYFLAG0_USAGE_CERTIFY			0x01
#define SIGSUBF_KEYFLAG0_USAGE_SIGN				0x02
#define SIGSUBF_KEYFLAG0_USAGE_ENCRYPT_COMM		0x04
#define SIGSUBF_KEYFLAG0_USAGE_ENCRYPT_STORAGE	0x08
/* Meaningful only on self signature */
#define SIGSUBF_KEYFLAG0_PRIVATE_SPLIT			0x10
#define SIGSUBF_KEYFLAG0_PRIVATE_SHARED			0x80

/* Flag bits within SIGSUB_KEYSERVER_PREFERENCES */
#define SIGSUBF_KEYSERVER0_

/* Signature sub-subpacket types, within SIGSUB_NAI packets */
enum sigsubsubbyte {
	SIGSUBSUB_X509			= 1
};

/* Version of X509 translation code */
#define SIGSUBSUB_X509_VERSION_HI	0x01
#define SIGSUBSUB_X509_VERSION_LO	0x04


#include "pgpOpaqueStructs.h"

/*
 * Okay, finally we start the function declarations.
 */
RingPool  *ringPoolCreate(PGPEnv const *env);
/* Destroy everything immediately, dropping all locks! */
void  ringPoolDestroy(RingPool *);
PGPContextRef ringPoolContext(RingPool *pool);

struct RingError
{
	RingFile *	f;	/* The RingFile for I/O errors */
	PGPUInt32	fpos;	/* The file position for I/O errors */
	PGPError	error;	/* PGP error code - kPGPError_* */
	int			syserrno;	/* Don't use plain "errno"; that's a macro! */
};

RingError const  *ringPoolError(RingPool const *);
void  ringPoolClearError(RingPool *);

/*
 * A RingSet is the root of a tree of objects.  The RingSet itself
 * is not a RingObject, but everything else under it is.
 * A full tree looks basically like this:
 * RingSet
 *  +--Key
 *  |   +--Secret (0 or more)
 *  |   +--Signature (0 or more)
 *  |   +--Signature (0 or more)
 *  |   +--Name (0 or more)
 *  |   |   +--Signature (0 or more)
 *  |   |   \--Signature (0 or more)
 *  |   \--Name (0 or more)
 *  |       \--Signature (0 or more)
 *  +--Key
 *  |   +--etc.
 * etc.
 *
 * A "secret" object is present if the key's secret components are
 * available.  In the standard PGP keyring file format, this is
 * actually stored with the key as a different type of key packet,
 * but the representation here is logically equivalent.
 *
 * There is one secret object per encrypted form of the secret
 * components.  Barring duplicate key errors, there is only one
 * secret object per file (if you attempt to write out more, the
 * library will make a guess at the best and write that out), but,
 * for example, changing the passphrase will create a second secret.
 *
 * Some sets are mutable, and RingObjects can be added to or deleted from
 * them, but the tree property is always preserved.  Adding an object
 * implicitly adds all of its parents.  Deleting an object implicitly
 * deletes all of its children.
 */
int  ringObjectType(union RingObject const *obj);
/* Type 0 is reserved for application use; it will never be allocated */
#define RINGTYPE_KEY	1
#define RINGTYPE_SEC	2
#define RINGTYPE_NAME	3
#define RINGTYPE_SIG	4
#define RINGTYPE_CRL	5
#define RINGTYPE_UNK	6	/* Object of unknown type */
#define RINGTYPE_MAX	6
/* Adding a new type needs to update ringObjectType() and ringNewObject() */

/*
 * Increase and decrease RingObject reference counts.  The ringIter
 * functions hold their current objects (at the current level and all
 * parent levels) automatically and release them when the ringIterator is
 * advanced to another location.  If you wish to refer to them after
 * advancing the RingIterator, Other functions that return RingObject
 * pointers hold them automatically, and they must be released explicitly
 * by ringObjectRelease().
 */
void  ringObjectHold(union RingObject *obj);
void  ringObjectRelease(union RingObject *obj);

/* Operations on RingSets */

RingPool  *ringSetPool(RingSet const *);

RingError const  *ringSetError(RingSet const *);
void  ringSetClearError(RingSet *);

int  ringSetIsMember(RingSet const *set,
	union RingObject const *object);
int  ringSetCount(RingSet const *set, unsigned *counts,
	unsigned depth);
int  ringSetCountTypes(RingSet const *set, unsigned *counts,
	unsigned max);

/* Create a new mutable RingSet */
RingSet  *ringSetCreate(RingPool *pool);
/* Create the universal RingSet */
RingSet  *ringSetCreateUniversal(RingPool *pool);
/* Free a RingSet (mutable or immutable) */
void  ringSetDestroy(RingSet *set);

/* Operate on a mutable RingSet */
int  ringSetAddObject(RingSet *set, union RingObject *obj);
int  ringSetRemObject(RingSet *set, union RingObject *obj);
int  ringSetAddSet(RingSet *set, RingSet const *set2);
int  ringSetSubtractSet(RingSet *set,
	RingSet const *set2);
int  ringSetAddObjectChildren(RingSet *dest,
	RingSet const *src, union RingObject *obj);
/* Convert a mutable RingSet to immutable */
PGPError  ringSetFreeze(RingSet *set);

/* Operate on immutable RingSets */
RingSet  *ringSetCopy(RingSet const *s);
RingSet  *
ringSetUnion(RingSet const *s1, RingSet const *s2);
RingSet  *
ringSetIntersection(RingSet const *s1, RingSet const *s2);
RingSet  *
ringSetDifference(RingSet const *s1, RingSet const *s2);

/* Lookups by keyID */
union RingObject  *
ringKeyById4(RingSet const *set, PGPByte pkalg, PGPByte const *keyid);
union RingObject  *
ringKeyById8(RingSet const *set, PGPByte pkalg, PGPByte const *keyid);

/* Operations on RingIterators */

RingIterator  *ringIterCreate(RingSet const *set);
void  ringIterDestroy(RingIterator *iter);
RingSet const  *ringIterSet(RingIterator const *iter);
RingError const  *ringIterError(

⌨️ 快捷键说明

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