From cb4a46e7fbe62d788e66ed6121c717a2d22a4d7c Mon Sep 17 00:00:00 2001 From: watcherhd Date: Thu, 21 Apr 2011 14:14:52 +0000 Subject: svn.miranda.im is moving to a new home! git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@7 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- cryptopp/PGPw/sdk6/include/pgpBase.h | 270 ++++++++ cryptopp/PGPw/sdk6/include/pgpBigNum.h | 208 ++++++ cryptopp/PGPw/sdk6/include/pgpCBC.h | 93 +++ cryptopp/PGPw/sdk6/include/pgpCFB.h | 127 ++++ cryptopp/PGPw/sdk6/include/pgpConfig.h | 96 +++ cryptopp/PGPw/sdk6/include/pgpEncode.h | 301 ++++++++ cryptopp/PGPw/sdk6/include/pgpErrors.h | 305 ++++++++ cryptopp/PGPw/sdk6/include/pgpFeatures.h | 176 +++++ cryptopp/PGPw/sdk6/include/pgpGroups.h | 322 +++++++++ cryptopp/PGPw/sdk6/include/pgpHMAC.h | 75 ++ cryptopp/PGPw/sdk6/include/pgpHash.h | 95 +++ cryptopp/PGPw/sdk6/include/pgpKeyServer.h | 360 ++++++++++ cryptopp/PGPw/sdk6/include/pgpKeys.h | 879 ++++++++++++++++++++++++ cryptopp/PGPw/sdk6/include/pgpMemoryMgr.h | 235 +++++++ cryptopp/PGPw/sdk6/include/pgpOptionList.h | 452 ++++++++++++ cryptopp/PGPw/sdk6/include/pgpPFLConfig.h | 51 ++ cryptopp/PGPw/sdk6/include/pgpPFLErrors.h | 97 +++ cryptopp/PGPw/sdk6/include/pgpPubTypes.h | 276 ++++++++ cryptopp/PGPw/sdk6/include/pgpPublicKey.h | 213 ++++++ cryptopp/PGPw/sdk6/include/pgpRandomPool.h | 49 ++ cryptopp/PGPw/sdk6/include/pgpSDKPrefs.h | 74 ++ cryptopp/PGPw/sdk6/include/pgpSockets.h | 476 +++++++++++++ cryptopp/PGPw/sdk6/include/pgpSymmetricCipher.h | 122 ++++ cryptopp/PGPw/sdk6/include/pgpTLS.h | 316 +++++++++ cryptopp/PGPw/sdk6/include/pgpUserInterface.h | 290 ++++++++ cryptopp/PGPw/sdk6/include/pgpUtilities.h | 231 +++++++ 26 files changed, 6189 insertions(+) create mode 100644 cryptopp/PGPw/sdk6/include/pgpBase.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpBigNum.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpCBC.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpCFB.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpConfig.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpEncode.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpErrors.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpFeatures.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpGroups.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpHMAC.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpHash.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpKeyServer.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpKeys.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpMemoryMgr.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpOptionList.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpPFLConfig.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpPFLErrors.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpPubTypes.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpPublicKey.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpRandomPool.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpSDKPrefs.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpSockets.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpSymmetricCipher.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpTLS.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpUserInterface.h create mode 100644 cryptopp/PGPw/sdk6/include/pgpUtilities.h (limited to 'cryptopp/PGPw/sdk6/include') diff --git a/cryptopp/PGPw/sdk6/include/pgpBase.h b/cryptopp/PGPw/sdk6/include/pgpBase.h new file mode 100644 index 0000000..7e460c8 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpBase.h @@ -0,0 +1,270 @@ +/*____________________________________________________________________________ + pgpBase.h + + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + This file deals with system dependencies to derive our very basic data + types. It should not contain any higher level types. + + $Id: pgpBase.h,v 1.27.16.1 1999/08/04 18:35:43 sluu Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpBase_h /* [ */ +#define Included_pgpBase_h + +#include "pgpPFLConfig.h" + + +#include + + + +#if !( defined(PGP_MACINTOSH) || defined(PGP_UNIX) || defined(PGP_WIN32) ) +#error one of {PGP_MACINTOSH, PGP_UNIX, PGP_WIN32} must be defined +#endif + +#if PGP_MACINTOSH +#include +#if __MWERKS__ && ! defined( __dest_os ) + #include + #define __dest_os __mac_os +#endif +#else + /* aCC bars on if this file is not included first */ + #if PGP_COMPILER_HPUX + #include + #endif /* PGP_COMPILER_HPUX */ + #include +#endif + +#if PGP_WIN32 +#include /* For size_t */ +#endif + +#if ! NO_LIMITS_H +#include +#endif + + +/*____________________________________________________________________________ + PGP basic types +____________________________________________________________________________*/ + +typedef unsigned char PGPBoolean; /* can be TRUE or FALSE */ +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + + +/* PGPUInt8, PGPInt8 */ +#if UCHAR_MAX == 0xff + +typedef unsigned char PGPUInt8; +typedef signed char PGPInt8; +#define MAX_PGPUInt8 UCHAR_MAX +#define MAX_PGPInt8 SCHAR_MAX + +#else +#error This machine has no 8-bit type +#endif + + +/* PGPUInt16, PGPInt16 */ +#if UINT_MAX == 0xffff + +typedef unsigned int PGPUInt16; +typedef int PGPInt16; +#define MAX_PGPUInt16 UINT_MAX +#define MAX_PGPInt16 INT_MAX + +#elif USHRT_MAX == 0xffff + +typedef unsigned short PGPUInt16; +typedef short PGPInt16; +#define MAX_PGPUInt16 USHRT_MAX +#define MAX_PGPInt16 SHRT_MAX + +#else +#error This machine has no 16-bit type +#endif + + +/* PGPUInt32, PGPInt32 */ +#if UINT_MAX == 0xfffffffful + +typedef unsigned int PGPUInt32; +typedef int PGPInt32; +#define MAX_PGPUInt32 UINT_MAX +#define MAX_PGPInt32 INT_MAX + +#elif ULONG_MAX == 0xfffffffful + +typedef unsigned long PGPUInt32; +typedef long PGPInt32; +#define MAX_PGPUInt32 ULONG_MAX +#define MAX_PGPInt32 LONG_MAX + +#elif USHRT_MAX == 0xfffffffful + +typedef unsigned short PGPUInt32; +typedef short PGPInt32; +#define MAX_PGPUInt32 USHRT_MAX +#define MAX_PGPInt32 SHRT_MAX + +#else +#error This machine has no 32-bit type +#endif + + +/*____________________________________________________________________________ + PGPUInt64, PGPInt64 + + Find a 64-bit data type, if possible. + The conditions here are more complicated to avoid using numbers that + will choke lesser preprocessors (like 0xffffffffffffffff) unless + we're reasonably certain that they'll be acceptable. + + Some *preprocessors* choke on constants that long even if the + compiler can accept them, so it doesn't work reliably to test values. + So cross our fingers and hope that it's a 64-bit type. + + GCC uses ULONG_LONG_MAX. Solaris uses ULLONG_MAX. + IRIX uses ULONGLONG_MAX. Are there any other names for this? +____________________________________________________________________________*/ +#if ULONG_MAX > 0xfffffffful +#if ULONG_MAX == 0xfffffffffffffffful + +typedef ulong PGPUInt64; +typedef long PGPInt64; +#define PGP_HAVE64 1 + +#endif +#endif + + +#ifndef PGP_HAVE64 + +#if defined(ULONG_LONG_MAX) || defined (ULLONG_MAX) || defined(ULONGLONG_MAX) +typedef unsigned long long PGPUInt64; +typedef long long PGPInt64; +#define PGP_HAVE64 1 + +#endif +#endif + + +#ifndef PGP_HAVE64 +#if defined(__MWERKS__) +#if __option( longlong ) + +typedef unsigned long long PGPUInt64; +typedef long long PGPInt64; +#define PGP_HAVE64 1 + +#endif +#endif +#endif + +#if PGP_HAVE64 +/* too painful to test all the variants above, so just do it this way */ +#define MAX_PGPUInt64 ((PGPUInt64)0xfffffffffffffffful) +#define MAX_PGPInt64 ((PGPInt64)0x7fffffffffffffff) +#endif + + +#if INT_MAX == 0x7FFFFFFFL +#define PGPENUM_TYPEDEF( enumName, typeName ) typedef enum enumName typeName +#else +#define PGPENUM_TYPEDEF( enumName, typeName ) typedef PGPInt32 typeName +#endif +#define kPGPEnumMaxValue INT_MAX + +#define PGP_ENUM_FORCE( enumName ) \ + k ## enumName ## force = kPGPEnumMaxValue + + +typedef PGPUInt8 PGPByte; + +typedef PGPInt32 PGPError; + +/* a simple value sufficient to hold any numeric or pointer type */ +typedef void * PGPUserValue; + +/* A PGPSize refers to in memory sizes. Use PGPFileOffset for file offsets */ +#if PGP_UNIX_HPUX +/* HPUX has conflicting types for size_t. This forces a PGPSize to + * always be the same type. */ +typedef unsigned long PGPSize; +#else +typedef size_t PGPSize; +#endif + +#define MAX_PGPSize ( ~(PGPSize)0 ) + +/* An offset or size of a file */ +#if PGP_UNIX +typedef off_t PGPFileOffset; +#else +#if PGP_HAVE64 +typedef PGPInt64 PGPFileOffset; +#else +typedef PGPInt32 PGPFileOffset; +#endif +#endif + +typedef PGPUInt32 PGPFlags; +typedef PGPUInt32 PGPTime; +typedef PGPUInt32 PGPTimeInterval; /* In milliseconds */ + +typedef struct PGPVersion +{ + PGPUInt16 majorVersion; + PGPUInt16 minorVersion; + +} PGPVersion; + +/*____________________________________________________________________________ + These macros should surround all C declarations in public + header files which define function or data symbols. +____________________________________________________________________________*/ + +#ifdef __cplusplus /* [ */ + +#define PGP_BEGIN_C_DECLARATIONS extern "C" { +#define PGP_END_C_DECLARATIONS } + +#else /* ] __cplusplus [ */ + +#define PGP_BEGIN_C_DECLARATIONS +#define PGP_END_C_DECLARATIONS + +#endif /* ] __cplusplus */ + + + + +#ifndef pgpMin +#define pgpMin(x,y) (((x)<(y)) ? (x) : (y)) +#endif + +#ifndef pgpMax +#define pgpMax(x,y) (((x)>(y)) ? (x) : (y)) +#endif + +#ifndef PGP_DEPRECATED +#define PGP_DEPRECATED 1 +#endif + +#endif /* ] Included_pgpBase_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpBigNum.h b/cryptopp/PGPw/sdk6/include/pgpBigNum.h new file mode 100644 index 0000000..81c6b17 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpBigNum.h @@ -0,0 +1,208 @@ +/*____________________________________________________________________________ + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + $Id: pgpBigNum.h,v 1.9 1999/03/10 02:47:07 heller Exp $ +____________________________________________________________________________*/ + + +#ifndef Included_pgpBigNum_h +#define Included_pgpBigNum_h + +#include "pgpBase.h" + +#include "pgpUtilities.h" + +#include "pgpMemoryMgr.h" + +PGP_BEGIN_C_DECLARATIONS + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + + +typedef struct PGPBigNum * PGPBigNumRef; +#define kPGPInvalidBigNumRef ( (PGPBigNumRef)NULL ) + + +/* Creates a new bignum, secure, or plain s*/ +PGPError PGPNewBigNum( PGPMemoryMgrRef mgr, + PGPBoolean secure, PGPBigNumRef *newBN ); + +/* destoys the bignum and all memory it uses */ +PGPError PGPFreeBigNum( PGPBigNumRef bn ); + + +/* Create a new big num with same value as src */ +PGPError PGPCopyBigNum( PGPBigNumRef src, PGPBigNumRef * dest ); + +/* Make existing bignum dest have same value as source */ +PGPError PGPAssignBigNum( PGPBigNumRef src, PGPBigNumRef dest ); + + +/* Swap two BigNums. Very fast. */ +PGPError PGPSwapBigNum( PGPBigNumRef a, PGPBigNumRef b); + + +/* + * Move bytes between the given buffer and the given BigNum encoded in + * base 256. I.e. after either of these, the buffer will be equal to + * (bn / 256^lsbyte) % 256^len. The difference is which is altered to + * match the other! + */ +PGPError PGPBigNumExtractBigEndianBytes( PGPBigNumRef bn, + PGPByte *dest, PGPUInt32 lsbyte, PGPUInt32 len ); + +PGPError PGPBigNumInsertBigEndianBytes(PGPBigNumRef bn, + PGPByte const *src, PGPUInt32 lsbyte, PGPUInt32 len ); + +/* The same, but the buffer is little-endian. */ +PGPError PGPBigNumExtractLittleEndianBytes( PGPBigNumRef bn, + PGPByte *dest, PGPUInt32 lsbyte, PGPUInt32 len ); + +PGPError PGPBigNumInsertLittleEndianBytes(PGPBigNumRef bn, + PGPByte const *src, PGPUInt32 lsbyte, PGPUInt32 len ); + +/* Return the least-significant bits (at least 16) of the BigNum */ +PGPUInt16 PGPBigNumGetLSWord( PGPBigNumRef bn ); + +/* + * Return the number of significant bits in the BigNum. + * 0 or 1+floor(log2(src)) + */ +PGPUInt32 PGPBigNumGetSignificantBits( PGPBigNumRef bn ); + +/* + * Adds two bignums into dest. Faster if dest is same as lhs or rhs. + */ +PGPError PGPBigNumAdd( PGPBigNumRef lhs, + PGPBigNumRef rhs, PGPBigNumRef dest ); + +/* + * lhs-rhs. dest and src may be the same, but bnSetQ(dest, 0) is faster. + * if dest < src, returns error and dest is undefined. + */ +PGPError PGPBigNumSubtract( PGPBigNumRef lhs, + PGPBigNumRef rhs, PGPBigNumRef dest, + PGPBoolean *underflow ); + + +/* Return sign (-1, 0, +1) of a-b. a <=> b --> bnCmpQ(a, b) <=> 0 */ +PGPInt32 PGPBigNumCompareQ( PGPBigNumRef bn, PGPUInt16 sm ); + +/* dest = src, where 0 <= src < 2^16. */ +PGPError PGPBigNumSetQ( PGPBigNumRef dest, PGPUInt16 sm ); + +/* dest = bn + sm, where 0 <= sm < 2^16 */ +PGPError PGPBigNumAddQ( PGPBigNumRef bn, PGPUInt16 sm, + PGPBigNumRef dest); + +/* dest = bn + sm, where 0 <= sm < 2^16 */ +PGPError PGPBigNumSubtractQ( PGPBigNumRef bn, PGPUInt16 sm, + PGPBigNumRef dest, PGPBoolean *underflow); + +/* Return sign (-1, 0, +1) of a-b. a <=> b --> bnCmp(a, b) <=> 0 */ +PGPInt32 PGPBigNumCompare( PGPBigNumRef lhs, PGPBigNumRef rhs); + +/* dest = src * src. dest may be the same as src, but it costs time. */ +PGPError PGPBigNumSquare( PGPBigNumRef src, PGPBigNumRef dest); + +/* dest = a * b. dest may be the same as a or b, but it costs time. */ +PGPError PGPBigNumMultiply( PGPBigNumRef lhs, PGPBigNumRef rhs, + PGPBigNumRef dest); + +/* dest = a * b, where 0 <= b < 2^16. dest and a may be the same. */ +PGPError PGPBigNumMultiplyQ( PGPBigNumRef lhs, PGPUInt16 sm, + PGPBigNumRef dest); + +/* + * q = n/d, r = n%d. r may be the same as n, but not d, + * and q may not be the same as n or d. + * re-entrancy issue: this temporarily modifies d, but restores + * it for return. + */ +PGPError PGPBigNumDivide( PGPBigNumRef numerator, + PGPBigNumRef denominator, + PGPBigNumRef quotient, + PGPBigNumRef remainder); +/* + * dest = n % d. dest and src may be the same, but not dest and d. + * re-entrancy issue: this temporarily modifies d, but restores + * it for return. + */ +PGPError PGPBigNumMod( PGPBigNumRef numerator, + PGPBigNumRef denominator, + PGPBigNumRef dest ); + +/* return src % d, where 0 <= d < 2^16. */ +PGPUInt16 PGPBigNumModQ( PGPBigNumRef numerator, + PGPUInt16 denominator ); + +/* n = n^exp, modulo "mod" "mod" *must* be odd */ +PGPError PGPBigNumExpMod( + PGPBigNumRef n, + PGPBigNumRef exponent, + PGPBigNumRef mod, + PGPBigNumRef dest ); + +/* + * dest = n1^e1 * n2^e2, modulo "mod". "mod" *must* be odd. + * dest may be the same as n1 or n2. + */ +PGPError PGPBigNumDoubleExpMod( + PGPBigNumRef n1, + PGPBigNumRef exponent1, + PGPBigNumRef n2, + PGPBigNumRef exponent2, + PGPBigNumRef mod, + PGPBigNumRef dest ); + +/* dest = 2^exp, modulo "mod" "mod" *must* be odd */ +PGPError PGPBigNumTwoExpMod( + PGPBigNumRef exponent, + PGPBigNumRef mod, + PGPBigNumRef dest ); + +/* dest = gcd(a, b). The inputs may overlap arbitrarily. */ +PGPError PGPBigNumGCD( PGPBigNumRef a, PGPBigNumRef b, + PGPBigNumRef dest ); + +/* dest = src^-1, modulo "mod". dest may be the same as src. */ +PGPError PGPBigNumInv( PGPBigNumRef src, + PGPBigNumRef mod, + PGPBigNumRef dest ); + + +/* Shift dest left "amt" places */ +PGPError PGPBigNumLeftShift( PGPBigNumRef dest, PGPUInt32 amt ); + +/* Shift dest right "amt" places, discarding low-order bits */ +PGPError PGPBigNumRightShift( PGPBigNumRef dest, PGPUInt32 amt ); + +/* right shift all low order 0-bits, return number of bits shifted */ +PGPUInt16 PGPBigNumMakeOdd( PGPBigNumRef dest ); + + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif + +PGP_END_C_DECLARATIONS + +#endif /* Included_pgpBigNum_h */ + + + + + + + + + + + + + + + diff --git a/cryptopp/PGPw/sdk6/include/pgpCBC.h b/cryptopp/PGPw/sdk6/include/pgpCBC.h new file mode 100644 index 0000000..9e3ea03 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpCBC.h @@ -0,0 +1,93 @@ +/*____________________________________________________________________________ + pgpCBC.h + + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + $Id: pgpCBC.h,v 1.5 1999/03/10 02:47:09 heller Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpCBC_h /* [ */ +#define Included_pgpCBC_h + +#include "pgpSymmetricCipher.h" + + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +/*____________________________________________________________________________ + A CBC context requires use of a symmetric cipher which has been created + and whose key has been set. An error will be returned if this is not + the case. + + After the call, the CBCContextRef "owns" the + symmetric ref and will dispose of it properly (even if an error + occurs). The caller should no longer reference it. +____________________________________________________________________________*/ +PGPError PGPNewCBCContext( PGPSymmetricCipherContextRef ref, + PGPCBCContextRef *outRef ); + + +/*____________________________________________________________________________ + Disposal clears all data in memory before releasing it. +____________________________________________________________________________*/ +PGPError PGPFreeCBCContext( PGPCBCContextRef ref ); + + +/*____________________________________________________________________________ + Make an exact copy, including current state. Original is not changed. +____________________________________________________________________________*/ +PGPError PGPCopyCBCContext( PGPCBCContextRef ref, PGPCBCContextRef *outRef ); + + + +/*____________________________________________________________________________ + IV size is implicit (same size as the symmetric cipher block size). + IV is *copied*. + Caller may want to destroy the original after passing it in. +____________________________________________________________________________*/ +PGPError PGPInitCBC( PGPCBCContextRef ref, + const void *key, + const void *initializationVector ); + + +/*____________________________________________________________________________ + Call repeatedly to process arbitrary amounts of data. Each call must + have bytesIn be a multiple of the cipher block size. +____________________________________________________________________________*/ +PGPError PGPCBCEncrypt( PGPCBCContextRef ref, + const void *in, PGPSize bytesIn, void *out ); + +PGPError PGPCBCDecrypt( PGPCBCContextRef ref, + const void *in, PGPSize bytesIn, void *out ); + + + +/*____________________________________________________________________________ + Get the symmetric cipher being used for this CBC context. + You can use this to determine useful things about the underlying cipher + such as its block size. +____________________________________________________________________________*/ +PGPError PGPCBCGetSymmetricCipher( PGPCBCContextRef ref, + PGPSymmetricCipherContextRef *outRef ); + + + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpCBC_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpCFB.h b/cryptopp/PGPw/sdk6/include/pgpCFB.h new file mode 100644 index 0000000..54ae8d7 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpCFB.h @@ -0,0 +1,127 @@ +/*____________________________________________________________________________ + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + $Id: pgpCFB.h,v 1.6 1999/03/10 02:47:11 heller Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpCFB_h /* [ */ +#define Included_pgpCFB_h + +#include "pgpSymmetricCipher.h" + + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +/*____________________________________________________________________________ + A CFB context requires use of a symmetric cipher which has been created + and whose key has been set. An error will be returned if this is not + the case. + + After the call, the CFBRef "owns" the symmetric ref and will + dispose of it properly (even if an error occurs). + The caller should no longer reference it. +____________________________________________________________________________*/ +PGPError PGPNewCFBContext( PGPSymmetricCipherContextRef ref, + PGPUInt16 interleaveFactor, + PGPCFBContextRef *outRef ); + + +/*____________________________________________________________________________ + Disposal clears all data in memory before releasing it. +____________________________________________________________________________*/ +PGPError PGPFreeCFBContext( PGPCFBContextRef ref ); + + +/*____________________________________________________________________________ + Make an exact copy, including current state. Original is not changed. +____________________________________________________________________________*/ +PGPError PGPCopyCFBContext( PGPCFBContextRef ref, + PGPCFBContextRef *outRef ); + + + +/*____________________________________________________________________________ + IV size is implicit (same size as the symmetric cipher block size). + IV is *copied*. + Caller may want to destroy the original after passing it in. + Calling this implicitly calls PGPResetCFB(). +____________________________________________________________________________*/ +PGPError PGPInitCFB( PGPCFBContextRef ref, + const void *key, + const void *initializationVector ); + + +/*____________________________________________________________________________ + Call repeatedly to process arbitrary amounts of data. +____________________________________________________________________________*/ +PGPError PGPCFBEncrypt( PGPCFBContextRef ref, + const void *in, PGPSize bytesIn, void *out ); + +PGPError PGPCFBDecrypt( PGPCFBContextRef ref, + const void *in, PGPSize bytesIn, void *out ); + + + +/*____________________________________________________________________________ + Get the symmetric cipher being used for this CFB context. + You can use this to determine useful things about the underlying cipher + such as its block size. +____________________________________________________________________________*/ +PGPError PGPCFBGetSymmetricCipher( + PGPCFBContextRef ref, + PGPSymmetricCipherContextRef *outRef ); + + + +/*____________________________________________________________________________ + Reset the feedback mechanism to use whatever we have so far, plus previous + bytes for a total of the cipher block size bytes. This effectively + changes the cipher block boundary. +____________________________________________________________________________*/ +PGPError PGPCFBSync( PGPCFBContextRef ref ); + + + +/*____________________________________________________________________________ + Fetch random bytes from the cipher. Returns the actual number of + random bytes obtained. +____________________________________________________________________________*/ +PGPError PGPCFBGetRandom( PGPCFBContextRef ref, + PGPSize requestCount, void *out, PGPSize *outCount); + + +/*____________________________________________________________________________ + Make more random bytes available using the supplied salt, which must + be the same as the symmetric cipher block size. +____________________________________________________________________________*/ +PGPError PGPCFBRandomCycle( PGPCFBContextRef ref, + const void *salt); + + +/*____________________________________________________________________________ + Make more random bytes available using the supplied salt, which must + be the same as the symmetric cipher block size. +____________________________________________________________________________*/ +PGPError PGPCFBRandomWash( PGPCFBContextRef ref, + const void *in, PGPSize bytesIn ); + + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpCFB_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpConfig.h b/cryptopp/PGPw/sdk6/include/pgpConfig.h new file mode 100644 index 0000000..f72f0d4 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpConfig.h @@ -0,0 +1,96 @@ +/* + * pgpConfig.h -- Configuration for the PGPsdk. This file contains + * the configuration information for the PGPsdk, and it should be + * included in all PGPsdk source files. + * + * $Id: pgpConfig.h,v 1.13 1997/09/30 21:03:13 lloyd Exp $ + */ + +/* Define to empty if the compiler does not support 'const' variables. */ +/* #undef const */ + +/* Define to `long' if doesn't define. */ +/* #undef off_t */ + +/* Define to `unsigned' if doesn't define. */ +/* #undef size_t */ + + +#ifndef Included_pgpConfig_h /* [ */ +#define Included_pgpConfig_h + +#include "pgpPFLConfig.h" + + + + + +#ifndef Included_pgpPFLConfig_h /* [ */ + +#define HAVE_STDARG_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_UNISTD_H 0 +#define HAVE_USHORT 0 +#define HAVE_UINT 0 +#define HAVE_ULONG 0 +#define NO_LIMITS_H 0 +#define NO_POPEN 1 + +#if defined( _MSC_VER ) +#define PGP_HAVE64 1 +typedef __int64 PGPInt64; +typedef unsigned __int64 PGPUInt64; + +#elif defined( __MWERKS__ ) + +#define PGP_HAVE64 0 + +#endif + + + +#endif /*Included_pgpPFLConfig_h*/ /* ] */ + + +/* Checks for various types */ +#define HAVE_UCHAR 0 + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Checks for various specific header files */ +#define HAVE_FCNTL_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_SYS_IOCTL_H 0 +#define HAVE_SYS_TIME_H 0 +#define HAVE_SYS_TIMEB_H 1 +#define HAVE_SYS_PARAM_H 0 + +/* Check if is broken and #includes wrong */ +#define TIME_WITH_SYS_TIME 0 + +/* Checks for various functions */ +#define HAVE_GETHRTIME 0 +#define HAVE_CLOCK_GETTIME 0 +#define HAVE_CLOCK_GETRES 0 +#define HAVE_GETTIMEOFDAY 0 +#define HAVE_GETITIMER 0 +#define HAVE_SETITIMER 0 +#define HAVE_FTIME 1 +#define HAVE_MKSTEMP 0 + + +#if defined( __MWERKS__ ) + +#define PGPTTYE /* nothing */ + +#elif defined( _MSC_VER ) + +/* Tags for exported functions, needed for dynamic linking on some platforms */ +#define PGPTTYE /* nothing */ + +#endif + + + +#endif /* ] Included_pgpConfig_h */ diff --git a/cryptopp/PGPw/sdk6/include/pgpEncode.h b/cryptopp/PGPw/sdk6/include/pgpEncode.h new file mode 100644 index 0000000..8b87c1c --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpEncode.h @@ -0,0 +1,301 @@ +/*____________________________________________________________________________ + pgpEncode.h + + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + This file contains the prototypes for functions which encode/decode files + and buffers. + + $Id: pgpEncode.h,v 1.104 1999/05/07 23:47:46 hal Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpEncode_h /* [ */ +#define Included_pgpEncode_h + +#include "pgpPubTypes.h" +#include "pgpTLS.h" + +#if PRAGMA_ALIGN_SUPPORTED +#pragma options align=mac68k +#endif + +/* + * The PGPEvent structure is used to notify clients of the encode API of + * various events. + */ + +/* PGP Event types */ + +enum PGPEventType_ +{ + kPGPEvent_NullEvent = 0, /* Nothing happened */ + kPGPEvent_InitialEvent = 1, /* Final event */ + kPGPEvent_FinalEvent = 2, /* Final event */ + kPGPEvent_ErrorEvent = 3, /* An error occurred */ + kPGPEvent_WarningEvent = 4, /* Warning event */ + kPGPEvent_EntropyEvent = 5, /* More entropy is needed */ + kPGPEvent_PassphraseEvent = 6, /* A passphrase is needed */ + kPGPEvent_InsertKeyEvent = 7, /* Smart card must be inserted */ + kPGPEvent_AnalyzeEvent = 8, /* Initial analysis event, + before any output */ + kPGPEvent_RecipientsEvent = 9, /* Recipient list report, + before any output */ + kPGPEvent_KeyFoundEvent = 10, /* Key packet found */ + kPGPEvent_OutputEvent = 11, /* Output specification needed */ + kPGPEvent_SignatureEvent = 12, /* Signature status report */ + kPGPEvent_BeginLexEvent = 13, /* Initial event per lexical unit*/ + kPGPEvent_EndLexEvent = 14, /* Final event per lexical unit */ + kPGPEvent_RecursionEvent = 15, /* Notification of recursive + job creation */ + kPGPEvent_DetachedSignatureEvent = 16, /* Need input for verification of + detached signature */ + kPGPEvent_KeyGenEvent = 17, /* Key generation progress */ + + kPGPEvent_KeyServerEvent = 18, /* Key Server progress */ + kPGPEvent_KeyServerSignEvent= 19, /* Key Server passphrase */ + kPGPEvent_KeyServerTLSEvent = 20, /* Key Server TLS event */ + kPGPEvent_KeyServerIdleEvent= 21, /* Idle during keyserver call */ + + kPGPEvent_SocketsIdleEvent = 22, /* Idle during sockets */ + kPGPEvent_DecryptionEvent = 23, /* Decryption data report */ + kPGPEvent_EncryptionEvent = 24, /* Encryption data report */ + PGP_ENUM_FORCE( PGPEventType_ ) +}; +PGPENUM_TYPEDEF( PGPEventType_, PGPEventType ); + + +/* PGP Analyze event callback codes */ + +enum PGPAnalyzeType_ +{ + kPGPAnalyze_Encrypted = 0, /* Encrypted message */ + kPGPAnalyze_Signed = 1, /* Signed message */ + kPGPAnalyze_DetachedSignature = 2, /* Detached signature */ + kPGPAnalyze_Key = 3, /* Key data */ + kPGPAnalyze_Unknown = 4, /* Non-pgp message */ + kPGPAnalyze_X509Certificate = 5, /* X.509 certificate */ + + PGP_ENUM_FORCE( PGPAnalyzeType_ ) +}; +PGPENUM_TYPEDEF( PGPAnalyzeType_, PGPAnalyzeType ); + + + + +/* Individual event information structs, combined as a union in PGPEvent */ + +typedef struct PGPEventNullData_ +{ + PGPFileOffset bytesWritten; + PGPFileOffset bytesTotal; +} PGPEventNullData; + +typedef struct PGPEventErrorData_ +{ + PGPError error; + void *errorArg; +} PGPEventErrorData; + +typedef struct PGPEventWarningData_ +{ + PGPError warning; + void *warningArg; +} PGPEventWarningData; + +typedef struct PGPEventEntropyData_ +{ + PGPUInt32 entropyBitsNeeded; +} PGPEventEntropyData; + +typedef struct PGPEventPassphraseData_ +{ + PGPBoolean fConventional; + PGPKeySetRef keyset; +} PGPEventPassphraseData; + +typedef struct PGPEventRecipientsData_ +{ + PGPKeySetRef recipientSet; + PGPUInt32 conventionalPassphraseCount; + PGPUInt32 keyCount; + PGPKeyID const * keyIDArray; +} PGPEventRecipientsData; + +typedef struct PGPEventKeyFoundData_ +{ + PGPKeySetRef keySet; +} PGPEventKeyFoundData; + +typedef struct PGPEventSignatureData_ +{ + PGPKeyID signingKeyID; + PGPKeyRef signingKey; + PGPBoolean checked; + PGPBoolean verified; + PGPBoolean keyRevoked; + PGPBoolean keyDisabled; + PGPBoolean keyExpired; + PGPBoolean keyMeetsValidityThreshold; + PGPValidity keyValidity; + PGPTime creationTime; +} PGPEventSignatureData; + +typedef struct PGPEventDecryptionData_ +{ + PGPCipherAlgorithm cipherAlgorithm; + PGPByte *sessionKey; + PGPSize sessionKeyLength; +} PGPEventDecryptionData; + +typedef struct PGPEventEncryptionData_ +{ + PGPCipherAlgorithm cipherAlgorithm; + PGPByte *sessionKey; + PGPSize sessionKeyLength; +} PGPEventEncryptionData; + +typedef struct PGPEventAnalyzeData_ +{ + PGPAnalyzeType sectionType; +} PGPEventAnalyzeData; + +typedef struct PGPEventOutputData_ +{ + PGPUInt32 messageType; + char *suggestedName; + PGPBoolean forYourEyesOnly; +} PGPEventOutputData; + +typedef struct PGPEventBeginLexData_ +{ + PGPUInt32 sectionNumber; + PGPSize sectionOffset; +} PGPEventBeginLexData; + +typedef struct PGPEventEndLexData_ +{ + PGPUInt32 sectionNumber; +} PGPEventEndLexData; + +typedef struct PGPEventKeyGenData_ +{ + PGPUInt32 state; +} PGPEventKeyGenData; + +typedef struct PGPEventKeyServerData_ +{ + PGPKeyServerRef keyServerRef; + PGPUInt32 state; /* PGPKeyServerState */ +} PGPEventKeyServerData; + +typedef struct PGPEventKeyServerSignData_ +{ + PGPKeyServerRef keyServerRef; +} PGPEventKeyServerSignData; + +typedef struct PGPEventKeyServerTLSData_ +{ + PGPKeyServerRef keyServerRef; + PGPUInt32 state; /* PGPKeyServerState */ + PGPtlsSessionRef tlsSession; +} PGPEventKeyServerTLSData; + +typedef struct PGPEventKeyServerIdleData_ +{ + PGPKeyServerRef keyServerRef; +} PGPEventKeyServerIdleData; + + +/* + * The following events have no event-specific data defined for them: + * kPGPEvent_InsertKeyEvent + * kPGPEvent_RecursionEvent + * kPGPEvent_DetachedSignatureEvent + * kPGPEvent_InitialEvent + * kPGPEvent_FinalEvent + * kPGPEvent_SocketsIdleEvent + */ + +/* Union of all event data structures above */ +typedef union PGPEventData_ +{ + PGPEventNullData nullData; + PGPEventErrorData errorData; + PGPEventWarningData warningData; + PGPEventEntropyData entropyData; + PGPEventPassphraseData passphraseData; + PGPEventRecipientsData recipientsData; + PGPEventKeyFoundData keyFoundData; + PGPEventSignatureData signatureData; + PGPEventDecryptionData decryptionData; + PGPEventEncryptionData encryptionData; + PGPEventAnalyzeData analyzeData; + PGPEventOutputData outputData; + PGPEventBeginLexData beginLexData; + PGPEventEndLexData endLexData; + PGPEventKeyGenData keyGenData; + PGPEventKeyServerData keyServerData; + PGPEventKeyServerSignData keyServerSignData; + PGPEventKeyServerTLSData keyServerTLSData; + PGPEventKeyServerIdleData keyServerIdleData; +} PGPEventData; + +/* Refs to internal "job" structure */ +typedef struct PGPJob * PGPJobRef; + +#define kInvalidPGPJobRef ((PGPJobRef) NULL) +#define PGPJobRefIsValid( ref ) ( (ref) != kInvalidPGPJobRef ) + +/* PGPEvent structure */ + +struct PGPEvent +{ + PGPVersion version; /* Version of event structure */ + struct PGPEvent_ *nextEvent; /* Allow lists of events */ + PGPJobRef job; /* Associated with what job */ + PGPEventType type; /* Type of event */ + PGPEventData data; /* Event specific data */ +}; +typedef struct PGPEvent PGPEvent; + + +#if PRAGMA_ALIGN_SUPPORTED +#pragma options align=reset +#endif + +PGP_BEGIN_C_DECLARATIONS + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +/* +** Functions to encode and decode. The variable parameters are one or more +** PGPOptionListRef's which describe the inputs, outputs, and options. +*/ + +PGPError PGPEncode(PGPContextRef context, + PGPOptionListRef firstOption, ...); +PGPError PGPDecode(PGPContextRef context, + PGPOptionListRef firstOption, ...); + +PGPError PGPAddJobOptions(PGPJobRef job, + PGPOptionListRef firstOption, ...); + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpEncode_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpErrors.h b/cryptopp/PGPw/sdk6/include/pgpErrors.h new file mode 100644 index 0000000..52ffcfe --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpErrors.h @@ -0,0 +1,305 @@ +/*____________________________________________________________________________ + pgpErrors.h + + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + Error codes for all PGP errors can be found in this file. + + $Id: pgpErrors.h,v 1.96 1999/05/11 19:01:17 heller Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpErrors_h /* [ */ +#define Included_pgpErrors_h + +#include "pgpPubTypes.h" + + +#include "pgpPFLErrors.h" + +#define kPGPErrorRange 1000 + +enum PGPError_ +{ + /* + NOTE: error code values must not be changed; + compiled client code depends on them. + */ + kPGPError_FirstError = -11500, + kPGPError_Last = -10500, + + kPGPError_BadPassphrase = -11500, + kPGPError_OptionNotFound = -11499, + +/* Errors from pgpEncode */ + kPGPError_RedundantOptions = -11498, + kPGPError_KeyRevoked = -11497, + kPGPError_KeyExpired = -11496, + kPGPError_KeyDisabled = -11495, + kPGPError_KeyInvalid = -11494, + kPGPError_KeyUnusableForEncryption = -11493, + kPGPError_KeyUnusableForSignature = -11492, + kPGPError_OutputBufferTooSmall = -11491, + kPGPError_InconsistentEncryptionAlgorithms = -11490, + kPGPError_MissingPassphrase = -11489, + kPGPError_CombinedConventionalAndPublicEncryption= -11488, + kPGPError_DetachedSignatureWithoutSigningKey= -11487, + kPGPError_DetachedSignatureWithEncryption = -11486, + kPGPError_NoInputOptions = -11485, + kPGPError_MultipleInputOptions = -11484, + kPGPError_InputFile = -11483, + kPGPError_NoOutputOptions = -11482, + kPGPError_MultipleOutputOptions = -11481, + kPGPError_MissingEventHandler = -11480, + kPGPError_MissingKeySet = -11479, + kPGPError_DetachedSignatureFound = -11478, + kPGPError_NoDecryptionKeyFound = -11477, + kPGPError_CorruptSessionKey = -11476, + kPGPError_SkipSection = -11475, + kPGPError_Interrupted = -11474, + kPGPError_TooManyARRKs = -11473, + kPGPError_KeyUnusableForDecryption = -11472, + + kPGPError_IncompatibleAPI = -11460, + +/* misc errors */ + kPGPError_NotMacBinary = -11450, + kPGPError_NoMacBinaryTranslationAvailable = -11449, + kPGPError_BadSignature = -11448, + kPGPError_CAPIUnsupportedKey = -11447, + kPGPError_SelfTestFailed = -11446, + kPGPError_SelfTestsNotExecuted = -11445, + kPGPError_BadIntegrity = -11444, + kPGPError_DeCompressionFailed = -11443, + +/* filter errors */ + + kPGPError_InconsistentFilterClasses = -11440, + kPGPError_UnsupportedLDAPFilter = -11439, + kPGPError_UnsupportedHKPFilter = -11438, + kPGPError_UnknownFilterType = -11437, + kPGPError_InvalidFilterParameter = -11436, + kPGPError_UnsupportedNetToolsCAFilter = -11435, + +/* old errors: */ + + kPGPError_OutOfRings = -11420, + kPGPError_BadHashNumber = -11419, + kPGPError_BadCipherNumber = -11418, + kPGPError_BadKeyLength = -11417, + kPGPError_SizeAdviseFailure = -11416, + kPGPError_ConfigParseFailure = -11415, + kPGPError_ConfigParseFailureBadFunction = -11414, + kPGPError_ConfigParseFailureBadOptions = -11413, + kPGPError_KeyIsLocked = -11412, + kPGPError_CantDecrypt = -11411, + kPGPError_UnknownString2Key = -11410, + kPGPError_BadSessionKeySize = -11409, + kPGPError_UnknownVersion = -11408, + kPGPError_BadSessionKeyAlgorithm = -11407, + kPGPError_UnknownSignatureType = -11406, + kPGPError_BadSignatureSize = -11405, + kPGPError_SignatureBitsWrong = -11404, + kPGPError_ExtraDateOnSignature = -11403, + kPGPError_SecretKeyNotFound = -11402, + kPGPError_AdditionalRecipientRequestKeyNotFound = -11401, + kPGPError_InvalidCommit = -11400, + kPGPError_CantHash = -11399, + kPGPError_UnbalancedScope = -11398, + kPGPError_WrongScope = -11397, + kPGPError_FIFOReadError = -11396, + kPGPError_RandomSeedTooSmall = -11395, + kPGPError_EnvPriorityTooLow = -11394, + kPGPError_UnknownCharMap = -11393, + kPGPError_AsciiParseIncomplete = -11392, + kPGPError_BadPacket = -11391, + + kPGPError_TroubleKeySubKey = -11390, + kPGPError_TroubleSigSubKey = -11389, + kPGPError_TroubleBadTrust = -11388, + kPGPError_TroubleUnknownPacketByte = -11387, + kPGPError_TroubleUnexpectedSubKey = -11386, + kPGPError_TroubleUnexpectedName = -11385, + kPGPError_TroubleUnexpectedSignature = -11384, + kPGPError_TroubleUnexpectedUnknown = -11383, + kPGPError_TroubleUnexpectedTrust = -11382, + kPGPError_TroubleKeyTooBig = -11381, + kPGPError_TroubleSecretKeyTooBig = -11380, + kPGPError_TroubleNameTooBig = -11379, + kPGPError_TroubleSignatureTooBig = -11378, + kPGPError_TroubleUnknownTooBig = -11377, + kPGPError_TroubleDuplicateKeyID = -11376, + kPGPError_TroubleDuplicateKey = -11375, + kPGPError_TroubleDuplicateSecretKey = -11374, + kPGPError_TroubleDuplicateName = -11373, + kPGPError_TroubleDuplicateSignature = -11372, + kPGPError_TroubleDuplicateUnknown = -11371, + kPGPError_TroubleBareKey = -11370, + kPGPError_TroubleVersionBugPrev = -11369, + kPGPError_TroubleVersionBugCur = -11368, + kPGPError_TroubleOldSecretKey = -11367, + kPGPError_TroubleNewSecretKey = -11366, + kPGPError_TroubleImportingNonexportableSignature= -11365, + kPGPError_TroubleDuplicateCRL = -11364, + kPGPError_TroubleCRLTooBig = -11363, + + /* + * The set of errors in this range are the ones which will NOT abort + * a keyring check operation. These errors just make us skip the key + * and go on to the next. + */ +kPGPError_KEY_MIN = -11350, + kPGPError_KEY_LONG = kPGPError_KEY_MIN, + kPGPError_KeyPacketTruncated = -11349, + kPGPError_UnknownKeyVersion = -11348, + kPGPError_UnknownPublicKeyAlgorithm = -11347, + kPGPError_MalformedKeyModulus = -11346, + kPGPError_MalformedKeyExponent = -11345, + kPGPError_RSAPublicModulusIsEven = -11344, + kPGPError_RSAPublicExponentIsEven = -11343, + kPGPError_MalformedKeyComponent = -11342, + kPGPError_KeyTooLarge = -11341, + kPGPError_PublicKeyTooSmall = -11340, + kPGPError_PublicKeyTooLarge = -11339, + kPGPError_PublicKeyUnimplemented = -11338, + kPGPError_CRLPacketTruncated = -11337, +kPGPError_KEY_MAX = kPGPError_PublicKeyUnimplemented, + + +/* kPGPError_SIG_MAX */ + kPGPError_SIG_LONG = -11330, + kPGPError_TruncatedSignature = -11329, + kPGPError_MalformedSignatureInteger = -11328, + kPGPError_UnknownSignatureAlgorithm = -11327, + kPGPError_ExtraSignatureMaterial = -11326, + kPGPError_UnknownSignatureVersion = -11325, + kPGPError_RevocationKeyNotFound = -11324, +/* kPGPError_SIG_MIN */ + +/* kPGPError_KEYDB_MAX */ + kPGPError_OutOfEntropy = -11320, + kPGPError_ItemIsReadOnly = -11319, + kPGPError_InvalidProperty = -11318, + kPGPError_FileCorrupt = -11317, + kPGPError_DuplicateCert = -11316, + kPGPError_DuplicateUserID = -11315, + kPGPError_CertifyingKeyDead = -11314, + kPGPError_ItemWasDeleted = -11313, + kPGPError_KeyDBMismatch = -11312, +/* kPGPError_KEYDB_MIN = kPGPError_KeyDBMismatch */ + +/* kPGPError_SERVER_MAX */ + kPGPError_ServerInProgress = -11300, + kPGPError_ServerOperationNotSupported = -11299, + kPGPError_ServerInvalidProtocol = -11298, + kPGPError_ServerRequestFailed = -11297, + kPGPError_ServerOpen = -11296, + kPGPError_ServerNotOpen = -11295, + kPGPError_ServerKeyAlreadyExists = -11294, + kPGPError_ServerNotInitialized = -11293, + kPGPError_ServerPartialAddFailure = -11292, + kPGPError_ServerCorruptKeyBlock = -11291, + kPGPError_ServerUnknownResponse = -11290, + kPGPError_ServerTimedOut = -11289, + kPGPError_ServerOpenFailed = -11288, + kPGPError_ServerAuthorizationRequired = -11287, + kPGPError_ServerAuthorizationFailed = -11286, + kPGPError_ServerSearchFailed = -11285, + kPGPError_ServerPartialSearchResults = -11284, + kPGPError_ServerBadKeysInSearchResults = -11283, + kPGPError_ServerKeyFailedPolicy = -11282, + kPGPError_ServerOperationRequiresTLS = -11281, + kPGPError_ServerNoStaticStorage = -11280, + kPGPError_ServerCertNotFound = -11279, + +/* TLS errors */ + kPGPError_TLSUnexpectedClose = -11250, + kPGPError_TLSProtocolViolation = -11249, + kPGPError_TLSVersionUnsupported = -11248, + kPGPError_TLSWrongState = -11247, + kPGPError_TLSAlertReceived = -11246, + kPGPError_TLSKeyUnusable = -11245, + kPGPError_TLSNoCommonCipher = -11244, + kPGPError_TLSWouldBlock = -11243, + kPGPError_TLSRcvdHandshakeRequest = -11242, + +/* X509 certificate errors */ + kPGPError_X509NeededCertNotAvailable = -11240, + kPGPError_X509SelfSignedCert = -11239, + kPGPError_X509InvalidCertificateSignature = -11238, + kPGPError_X509InvalidCertificateFormat = -11237, + + kPGPError_BigNumNoInverse = -11150, + +/* PGPSockets errors */ + kPGPError_SocketsNetworkDown = -11100, + kPGPError_SocketsNotInitialized = -11099, + kPGPError_SocketsInProgress = -11098, + kPGPError_SocketsNotConnected = -11097, + kPGPError_SocketsNotBound = -11096, + kPGPError_SocketsOperationNotSupported = -11095, + kPGPError_SocketsProtocolNotSupported = -11094, + kPGPError_SocketsAddressFamilyNotSupported = -11093, + kPGPError_SocketsNotASocket = -11092, + kPGPError_SocketsAddressInUse = -11091, + kPGPError_SocketsBufferOverflow = -11090, + kPGPError_SocketsListenQueueFull = -11089, + kPGPError_SocketsAddressNotAvailable = -11088, + kPGPError_SocketsAlreadyConnected = -11087, + kPGPError_SocketsTimedOut = -11086, + kPGPError_SocketsNoStaticStorage = -11085, + + kPGPError_SocketsHostNotFound = -11050, + kPGPError_SocketsDomainServerError = -11049, + +/* Errors from X.509 layer */ + kPGPError_X509AttributeNotSupported = -10999, + kPGPError_InvalidPKCS7Encoding = -10998, + kPGPError_CMSInitialization = -10997, + kPGPError_InvalidDistinguishedName = -10996, + kPGPError_CertRequestCreationFailure = -10995, + kPGPError_MissingX509Certificate = -10994, + kPGPError_PKCS7SignFailure = -10993, + kPGPError_ASNPackFailure = -10992, + kPGPError_InvalidInputFormat = -10991, + kPGPError_InvalidOutputFormat = -10990, + kPGPError_InvalidCertificateExtension = -10989, + kPGPError_PublicKeyNotFound = -10988, + + kPGPError_CRSMissingRequiredAttribute = -10979, + kPGPError_CRSInvalidCharacter = -10978, + kPGPError_CRSInvalidAttributeType = -10977, + kPGPError_CRSInvalidCertType = -10976, + kPGPError_CRSInvalidAttributeValueLength = -10975, + kPGPError_CRSInvalidAuthenticateValue = -10974, + + + kPGPError_DummyEnumValue + /* kPGPError_Last */ +} ; + + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +PGPError PGPGetErrorString( PGPError theError, + PGPSize bufferSize, char * theString ); + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + + +#endif /* ] Included_pgpErrors_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpFeatures.h b/cryptopp/PGPw/sdk6/include/pgpFeatures.h new file mode 100644 index 0000000..96016ad --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpFeatures.h @@ -0,0 +1,176 @@ +/*____________________________________________________________________________ + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + Determine which features are present in the PGPsdk. This is the only + way to correctly determine which features are present. The version + number may be the same for different builds that lack some features. + + $Id: pgpFeatures.h,v 1.18.20.1 1999/08/17 20:04:30 cpeterson Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpFeatures_h /* [ */ +#define Included_pgpFeatures_h + + +#include "pgpPubTypes.h" + + + +#if PRAGMA_ALIGN_SUPPORTED +#pragma options align=mac68k /* [ */ +#endif + + +/*____________________________________________________________________________ + Each selector designates a PGPFlags word, which can be obtained via + PGPGetFeatureFlags(). The flags can be tested using the + supplied masks. We can add more selectors as needed. The masks + are not intended to be restricted to a single bit. + Flags should not be used for attributes that have unknown length. + + A kPGPError_ItemNotFound will be returned if the caller specifies + a selector which is not recognized by the PGPsdk. This could + occur if an app links to an older version of the SDK. +____________________________________________________________________________*/ + +/* selectors which are passed to PGPGetFeatureFlags */ +enum PGPFeatureSelector_ +{ + kPGPFeatures_GeneralSelector = 1, + kPGPFeatures_ImplementationSelector = 2, + PGP_ENUM_FORCE( PGPFeatureSelector_ ) +}; +PGPENUM_TYPEDEF( PGPFeatureSelector_, PGPFeatureSelector ); + + +/* flags for kPGPFeatures_GeneralSelector */ +enum +{ + kPGPFeatureMask_CanEncrypt = 0x1, + kPGPFeatureMask_CanDecrypt = 0x2, + kPGPFeatureMask_CanSign = 0x4, + kPGPFeatureMask_CanVerify = 0x8, + kPGPFeatureMask_CanGenerate = 0x10, + kPGPFeatureMask_RngHardware = 0x20 +}; + + +/* flags for kPGPFeatures_ImplementationSelector */ +enum +{ + kPGPFeatureMask_IsDebugBuild = 0x1, + kPGPFeatureMask_HasTimeout = 0x2 +}; + + + +typedef struct PGPAlgorithmInfo +{ + char shortName[ 32 ]; + char longName[ 96 ]; + char copyright[ 128 ]; + PGPFlags flags; /* reserved; 0 for now */ + PGPUInt32 reserved[ 16 ]; /* reserved; 0 for now */ +} PGPAlgorithmInfo; + + +typedef struct PGPPublicKeyAlgorithmInfo +{ + PGPAlgorithmInfo info; + + PGPPublicKeyAlgorithm algID; + + PGPBoolean canEncrypt; + PGPBoolean canDecrypt; + PGPBoolean canSign; + PGPBoolean canVerify; + PGPBoolean canGenerate; + PGPBoolean reserved1; + PGPBoolean reserved2; + PGPBoolean reserved3; + + PGPUInt32 reserved[ 8 ]; +} PGPPublicKeyAlgorithmInfo; + + +typedef struct PGPSymmetricCipherInfo +{ + PGPAlgorithmInfo info; + + PGPCipherAlgorithm algID; + + PGPUInt32 reserved[ 8 ]; +} PGPSymmetricCipherInfo; + + + +#if PRAGMA_ALIGN_SUPPORTED +#pragma options align=reset /* ] */ +#endif + + + + + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + + +/* see kPGPsdkAPIVersion in pgpUtilities.h for version format */ +PGPError PGPGetSDKVersion( PGPUInt32 *version ); + + +/*____________________________________________________________________________ + Return a C string of the form: + + "PGPsdk version 1.0 (C) Network Associates, Inc" +____________________________________________________________________________*/ +PGPError PGPGetSDKString( char theString[ 256 ] ); + + + +/* return a flags word for the feature selector */ +PGPError PGPGetFeatureFlags( PGPFeatureSelector selector, + PGPFlags *flags ); + +/* use this to test whether a feature exists after getting flags */ +#define PGPFeatureExists( flags, maskValue ) \ + ( ( (flags) & (maskValue) ) != 0 ) + + +/*____________________________________________________________________________ + Routines to determine which algorithms are present. + + To determine if a specific algorithm is available, you will need to + index through the available algorithms and check the algorithm ID. +____________________________________________________________________________*/ +PGPError PGPCountPublicKeyAlgorithms( PGPUInt32 *numPKAlgs ); +PGPError PGPGetIndexedPublicKeyAlgorithmInfo( PGPUInt32 theIndex, + PGPPublicKeyAlgorithmInfo *info); + +PGPError PGPCountSymmetricCiphers( PGPUInt32 *numPKAlgs ); +PGPError PGPGetIndexedSymmetricCipherInfo( PGPUInt32 theIndex, + PGPSymmetricCipherInfo *info); + + + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + + + + +#endif /* ] Included_pgpFeatures_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpGroups.h b/cryptopp/PGPw/sdk6/include/pgpGroups.h new file mode 100644 index 0000000..65e4bc2 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpGroups.h @@ -0,0 +1,322 @@ +/*____________________________________________________________________________ + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + $Id: pgpGroups.h,v 1.6 1999/03/10 02:51:18 heller Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpGroups_h /* [ */ +#define Included_pgpGroups_h + +#include "pgpPubTypes.h" +#include "pgpEncode.h" + +#if PRAGMA_ALIGN_SUPPORTED +#pragma options align=mac68k +#endif + +#define kPGPMaxGroupNameLength 63 +#define kPGPMaxGroupDescriptionLength 63 + +typedef char PGPGroupName[ kPGPMaxGroupNameLength + 1 ]; +typedef char PGPGroupDescription[ kPGPMaxGroupDescriptionLength + 1 ]; + + +typedef struct PGPGroupSet * PGPGroupSetRef; +typedef struct PGPGroupIter * PGPGroupItemIterRef; + +#define kInvalidPGPGroupSetRef ((PGPGroupSetRef) NULL) +#define kInvalidPGPGroupItemIterRef ((PGPGroupItemIterRef) NULL) + +#define PGPGroupSetRefIsValid(ref) ((ref) != kInvalidPGPGroupSetRef) +#define PGPGroupItemIterRefIsValid(ref) ((ref) != kInvalidPGPGroupItemIterRef) + +/* any type will do that is distinct */ +typedef PGPUInt32 PGPGroupID; +#define kPGPInvalidGroupID ( (PGPGroupID)0 ) + +enum PGPGroupItemType_ +{ + kPGPGroupItem_KeyID = 1, + kPGPGroupItem_Group, + + PGP_ENUM_FORCE( PGPGroupItemType_) +}; +PGPENUM_TYPEDEF( PGPGroupItemType_, PGPGroupItemType ); + +/*____________________________________________________________________________ + A run-time group item, used when iterating through a group. + For client use; not necessarily the internal storage format. + + 'userValue' is *not* saved to disk. +____________________________________________________________________________*/ + +typedef struct PGPGroupItem +{ + PGPGroupItemType type; + PGPUserValue userValue; + + union + { + /* type selects which substructure */ + struct /* if kGroupItem_Group */ + { + PGPGroupID id; + } group; + + struct /* if kGroupItem_KeyID */ + { + PGPPublicKeyAlgorithm algorithm; + PGPKeyID keyID; + } key; + } u; + + PGPUInt32 reserved[4]; + +} PGPGroupItem; + + +typedef PGPInt32 (*PGPGroupItemCompareProc)( PGPGroupItem *, + PGPGroupItem *, PGPUserValue userValue ); + +/*____________________________________________________________________________ + Info obtained via PGPGetGroupInfo. +____________________________________________________________________________*/ + +typedef struct PGPGroupInfo +{ + PGPGroupID id; + PGPGroupName name; + PGPGroupName description; + PGPUserValue userValue; + +} PGPGroupInfo; + + +typedef PGPFlags PGPGroupItemIterFlags; +/* flag (1UL << 0 ) is reserved */ +#define kPGPGroupIterFlags_Recursive (PGPFlags)(1UL << 1 ) +#define kPGPGroupIterFlags_Keys (PGPFlags)(1UL << 2 ) +#define kPGPGroupIterFlags_Groups (PGPFlags)(1UL << 3 ) + +#define kPGPGroupIterFlags_AllKeysRecursive \ + ( kPGPGroupIterFlags_Recursive | kPGPGroupIterFlags_Keys ) + +#define kPGPGroupIterFlags_AllGroupsRecursive \ + ( kPGPGroupIterFlags_Recursive | kPGPGroupIterFlags_Groups ) + +#define kPGPGroupIterFlags_AllItems \ + ( kPGPGroupIterFlags_Keys | kPGPGroupIterFlags_Groups ) + +#define kPGPGroupIterFlags_AllRecursive \ + ( kPGPGroupIterFlags_Recursive | kPGPGroupIterFlags_AllItems ) + + + +#if PRAGMA_ALIGN_SUPPORTED +#pragma options align=reset +#endif + +PGP_BEGIN_C_DECLARATIONS + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + + +/*____________________________________________________________________________ + Manipulating pgp group sets (PGPGroupSetRef) +____________________________________________________________________________*/ +/* create a new, empty groups collection */ +PGPError PGPNewGroupSet( PGPContextRef context, PGPGroupSetRef *outRef ); + +/* file is *not* left open; all data is loaded into memory */ +PGPError PGPNewGroupSetFromFile( PGPContextRef context, + PGPFileSpecRef file, + PGPGroupSetRef *outRef ); + +#if PGP_MACINTOSH +PGPError PGPNewGroupSetFromFSSpec( PGPContextRef context, + const FSSpec *spec, PGPGroupSetRef *outRef ); +#endif + +/* overwrites existing. Don't bother unless PGPGroupSetNeedsCommit() */ +PGPError PGPSaveGroupSetToFile( PGPGroupSetRef set, PGPFileSpecRef file ); + +/* free all data structures; be sure to save first if you want */ +PGPError PGPFreeGroupSet( PGPGroupSetRef set ); + + +/* has the group changed? */ +PGPBoolean PGPGroupSetNeedsCommit( PGPGroupSetRef set ); + +PGPContextRef PGPGetGroupSetContext( PGPGroupSetRef set ); + +/* export the groupset to a buffer. Use PGPFreeData to free the buffer */ +PGPError PGPExportGroupSetToBuffer( PGPGroupSetRef set, void **buffer, + PGPSize *bufferSize ); + +/* import a groupset from a buffer */ +PGPError PGPImportGroupSetFromBuffer(PGPContextRef context, void *buffer, + PGPSize bufSize, PGPGroupSetRef *outSet ); + +/*____________________________________________________________________________ + Manipulating groups + + Groups are always referred to by IDs which remain valid until the set + is disposed. +____________________________________________________________________________*/ + +/* initial parent ID is kPGPInvalidGroupID */ +PGPError PGPNewGroup( PGPGroupSetRef set, + const char * name, const char *description, PGPGroupID *id ); + +PGPError PGPCountGroupsInSet( PGPGroupSetRef set, + PGPUInt32 *numGroups); +PGPError PGPGetIndGroupID( PGPGroupSetRef set, + PGPUInt32 groupIndex, PGPGroupID *id ); + +/* delete this group from the set */ +/* All references to it are removed in all sets */ +PGPError PGPDeleteGroup( PGPGroupSetRef set, PGPGroupID id ); + +/* delete the indexed item from the group */ +/* the item may be a group or a key */ +PGPError PGPDeleteIndItemFromGroup( PGPGroupSetRef set, + PGPGroupID id, PGPUInt32 item ); + +/* same as PGPDeleteIndItemFromGroup, but accepts an item */ +PGPError PGPDeleteItemFromGroup( PGPGroupSetRef set, + PGPGroupID id, PGPGroupItem const *item ); + + +PGPError PGPGetGroupInfo( PGPGroupSetRef set, + PGPGroupID id, PGPGroupInfo *info ); + +PGPError PGPSetGroupName( PGPGroupSetRef set, + PGPGroupID id, const char * name ); +PGPError PGPSetGroupUserValue( PGPGroupSetRef set, + PGPGroupID id, PGPUserValue userValue ); +PGPError PGPSetGroupDescription( PGPGroupSetRef set, + PGPGroupID id, const char * name ); + +/* 'item' specifies a group or a key id */ +/* you must fill the item in completely */ +PGPError PGPAddItemToGroup( PGPGroupSetRef set, + PGPGroupItem const *item, PGPGroupID group ); + + +PGPError PGPMergeGroupIntoDifferentSet( PGPGroupSetRef fromSet, + PGPGroupID fromID, PGPGroupSetRef toSet ); + +PGPError PGPMergeGroupSets( PGPGroupSetRef fromSet, + PGPGroupSetRef intoSet ); + +PGPError PGPCopyGroupSet(PGPGroupSetRef sourceSet, + PGPGroupSetRef *destSet); + +/*____________________________________________________________________________ + Manipulating group items +____________________________________________________________________________*/ + +/* count how many items there are in a group */ +/* totalItems includes keys and groups */ +PGPError PGPCountGroupItems( PGPGroupSetRef set, + PGPGroupID id, PGPBoolean recursive, + PGPUInt32 * numKeys, + PGPUInt32 * totalItems ); + +/* non-recursive call; index only applies to group itself */ +PGPError PGPGetIndGroupItem( PGPGroupSetRef set, + PGPGroupID id, PGPUInt32 groupIndex, PGPGroupItem * item ); + +/* use PGPGetIndGroupItem() if you want to get the user value */ +PGPError PGPSetIndGroupItemUserValue( PGPGroupSetRef set, + PGPGroupID id, PGPUInt32 groupIndex, PGPUserValue userValue ); + +PGPError PGPSortGroupItems( PGPGroupSetRef set, PGPGroupID id, + PGPGroupItemCompareProc, PGPUserValue userValue ); + +PGPError PGPSortGroupSet( PGPGroupSetRef set, + PGPGroupItemCompareProc, PGPUserValue userValue ); + +/*____________________________________________________________________________ + PGPGroupItemIterRef--iterator through group items. + + Special note: this is not a full-fledged iterator. You may *not* add + or delete items while iterating and you may only move forward. However, + you may change the values of items. +____________________________________________________________________________*/ + +PGPError PGPNewGroupItemIter( PGPGroupSetRef set, PGPGroupID id, + PGPGroupItemIterFlags flags, PGPGroupItemIterRef *iter ); + +PGPError PGPFreeGroupItemIter( PGPGroupItemIterRef iter ); + +/* returns kPGPError_EndOfIteration when done */ +PGPError PGPGroupItemIterNext( PGPGroupItemIterRef iter, + PGPGroupItem * item ); + +/*____________________________________________________________________________ + Group utilities +____________________________________________________________________________*/ + +/*____________________________________________________________________________ + Return the lowest validity of any item in the group + keyset should contain all keys available + It is not an error if keys can't be found; you may want to check + the not found count. + + The lowest validity is kPGPValidity_Invalid and kPGPValidity_Unknown + is never returned. +____________________________________________________________________________*/ +PGPError PGPGetGroupLowestValidity( PGPGroupSetRef set, PGPGroupID id, + PGPKeySetRef keySet, PGPValidity * lowestValidity, + PGPUInt32 * numKeysNotFound); + +/*____________________________________________________________________________ + All all the keys in the group (and its subgroups) to the keyset +____________________________________________________________________________*/ +PGPError PGPNewKeySetFromGroup( PGPGroupSetRef set, PGPGroupID id, + PGPKeySetRef masterSet, PGPKeySetRef * resultSet, + PGPUInt32 * numKeysNotFound); + +/*____________________________________________________________________________ + Create a simple, flattened group of unique key IDs from the source group. + Note that sourceSet and destSet must be different. +____________________________________________________________________________*/ +PGPError PGPNewFlattenedGroupFromGroup(PGPGroupSetRef sourceSet, + PGPGroupID sourceID, PGPGroupSetRef destSet, + PGPGroupID *destID); + +/*____________________________________________________________________________ + Perform a "standard" sort on a group +____________________________________________________________________________*/ +PGPError PGPSortGroupSetStd( PGPGroupSetRef set, PGPKeySetRef keys ); + + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpGroups_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ + + + + + + + + diff --git a/cryptopp/PGPw/sdk6/include/pgpHMAC.h b/cryptopp/PGPw/sdk6/include/pgpHMAC.h new file mode 100644 index 0000000..a04dc95 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpHMAC.h @@ -0,0 +1,75 @@ +/*____________________________________________________________________________ + pgpHMAC.h + + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + $Id: pgpHMAC.h,v 1.3 1999/03/10 02:51:38 heller Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpHMAC_h /* [ */ +#define Included_pgpHMAC_h + +#include "pgpPubTypes.h" +#include "pgpMemoryMgr.h" + + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +/*____________________________________________________________________________ + Create a new HMAC of the specified algorithm. + + If the algorithm is not available then kPGPError_AlgorithmNotAvailable is + returned. +____________________________________________________________________________*/ +PGPError PGPNewHMACContext( PGPMemoryMgrRef memoryMgr, + PGPHashAlgorithm algorithm, + PGPByte * secret, + PGPSize secretLen, + PGPHMACContextRef * outRef ); + +/*____________________________________________________________________________ + Any existing intermediate HMAC is lost. +____________________________________________________________________________*/ +PGPError PGPFreeHMACContext( PGPHMACContextRef ref ); + +/*____________________________________________________________________________ + Reset an HMAC as if it had been created anew. Any existing intermediate + hash is lost. +____________________________________________________________________________*/ +PGPError PGPResetHMAC( PGPHMACContextRef ref ); + +/*____________________________________________________________________________ + Continue the HMAC, accumulating an intermediate result +____________________________________________________________________________*/ +PGPError PGPContinueHMAC( PGPHMACContextRef ref, + const void *in, PGPSize numBytes ); + + +/*____________________________________________________________________________ + Finalize the HMAC, depositing the result into 'hmacOut'. + + This size of the output will be the same size as the hash + algorithm output. +____________________________________________________________________________*/ +PGPError PGPFinalizeHMAC( PGPHMACContextRef ref, void *hmacOut ); + + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpHMAC_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpHash.h b/cryptopp/PGPw/sdk6/include/pgpHash.h new file mode 100644 index 0000000..101120d --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpHash.h @@ -0,0 +1,95 @@ +/*____________________________________________________________________________ + pgpHash.h + + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + $Id: pgpHash.h,v 1.15 1999/03/10 02:51:20 heller Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpHashing_h /* [ */ +#define Included_pgpHashing_h + +#include "pgpPubTypes.h" +#include "pgpMemoryMgr.h" + + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +/*____________________________________________________________________________ + Create a new hash of the specified algorithm. + + If the algorithm is not available then kPGPError_AlgorithmNotAvailable is + returned. +____________________________________________________________________________*/ +PGPError PGPNewHashContext( PGPMemoryMgrRef memoryMgr, + PGPHashAlgorithm algorithm, + PGPHashContextRef * outRef ); + + +/*____________________________________________________________________________ + Any existing intermediate hash is lost. +____________________________________________________________________________*/ +PGPError PGPFreeHashContext( PGPHashContextRef ref ); + + +/*____________________________________________________________________________ + An exact duplicate of the hash is made. +____________________________________________________________________________*/ +PGPError PGPCopyHashContext( PGPHashContextRef ref, + PGPHashContextRef * outRef); + + + +/*____________________________________________________________________________ + Reset a hash as if it had been created anew. Any existing intermediate + hash is lost. +____________________________________________________________________________*/ +PGPError PGPResetHash( PGPHashContextRef ref ); + + +/*____________________________________________________________________________ + Continue the hash, accumulating an intermediate result +____________________________________________________________________________*/ +PGPError PGPContinueHash( PGPHashContextRef ref, + const void *in, PGPSize numBytes ); + + +/*____________________________________________________________________________ + Finalize the hash, depositing the result into 'hashOut'. + + After calling this routine, the hash is reset via PGPResetHash(). + If you want an intermediate result, use PGPCopyHash() and finalize the + copy. +____________________________________________________________________________*/ +PGPError PGPFinalizeHash( PGPHashContextRef ref, void *hashOut ); + + +/*____________________________________________________________________________ + Determine size of resulting hash in bytes e.g. a 160 bit hash yields 20. + Used for generic code which may not know how big a hash is being produced. + + Question: can we reasonably assume 8 bits per byte? If not, how does + PGPFinalizeHash return its result? +____________________________________________________________________________*/ +PGPError PGPGetHashSize( PGPHashContextRef ref, PGPSize *hashSize ); + + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpHashing_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpKeyServer.h b/cryptopp/PGPw/sdk6/include/pgpKeyServer.h new file mode 100644 index 0000000..25579aa --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpKeyServer.h @@ -0,0 +1,360 @@ +/*____________________________________________________________________________ + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + + + $Id: pgpKeyServer.h,v 1.43 1999/04/12 18:59:57 jason Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpKeyServer_h +#define Included_pgpKeyServer_h + +#include "pgpOptionList.h" +#include "pgpErrors.h" +#include "pgpGroups.h" +#include "pgpTLS.h" + + +enum PGPKeyServerState_ +{ + kPGPKeyServerState_Invalid = 0, + kPGPKeyServerState_Opening = 1, + kPGPKeyServerState_Querying = 2, + kPGPKeyServerState_ReceivingResults = 3, + kPGPKeyServerState_ProcessingResults = 4, + kPGPKeyServerState_Uploading = 5, + kPGPKeyServerState_Deleting = 6, + kPGPKeyServerState_Disabling = 7, + kPGPKeyServerState_Closing = 8, + + kPGPKeyServerState_TLSUnableToSecureConnection = 9, + kPGPKeyServerState_TLSConnectionSecured = 10, + + PGP_ENUM_FORCE(PGPKeyServerState_) +}; + +PGPENUM_TYPEDEF(PGPKeyServerState_, PGPKeyServerState); + +enum PGPKeyServerProtocol_ +{ + kPGPKeyServerProtocol_Invalid = 0, + kPGPKeyServerProtocol_LDAP = 1, + kPGPKeyServerProtocol_HTTP = 2, + kPGPKeyServerProtocol_LDAPS = 3, + kPGPKeyServerProtocol_HTTPS = 4, + + PGP_ENUM_FORCE( PGPKeyServerProtocol_ ) +}; + +PGPENUM_TYPEDEF( PGPKeyServerProtocol_, PGPKeyServerProtocol ); + +enum PGPKeyServerClass_ +{ + kPGPKeyServerClass_Invalid = 0, + kPGPKeyServerClass_PGP = 1, + kPGPKeyServerClass_NetToolsCA = 2, + kPGPKeyServerClass_Verisign = 3, + kPGPKeyServerClass_Entrust = 4, + + PGP_ENUM_FORCE( PGPKeyServerClass_ ) +}; + +PGPENUM_TYPEDEF( PGPKeyServerClass_, PGPKeyServerClass ); + +enum PGPKeyServerKeySpace_ /* These are only valid for LDAP keyservers */ +{ + kPGPKeyServerKeySpace_Invalid = 0, + kPGPKeyServerKeySpace_Default = 1, + kPGPKeyServerKeySpace_Normal = 2, + kPGPKeyServerKeySpace_Pending = 3, + + PGP_ENUM_FORCE( PGPKeyServerKeySpace_ ) +}; + +PGPENUM_TYPEDEF( PGPKeyServerKeySpace_, PGPKeyServerKeySpace ); + +enum PGPKeyServerAccessType_ /* These are only valid for LDAP keyservers */ +{ + kPGPKeyServerAccessType_Invalid = 0, + kPGPKeyServerAccessType_Default = 1, + kPGPKeyServerAccessType_Normal = 2, + kPGPKeyServerAccessType_Administrator = 3, + + PGP_ENUM_FORCE( PGPKeyServerAccessType_ ) +}; + +PGPENUM_TYPEDEF( PGPKeyServerAccessType_, PGPKeyServerAccessType ); + +/* PGPKeyServerMonitorValues are null terminated linked lists. + The values member is a null terminated array of char*s. +*/ + +typedef struct PGPKeyServerMonitorValues +{ + char * name; + char ** values; + struct PGPKeyServerMonitorValues * next; +} PGPKeyServerMonitorValues; + +typedef struct PGPKeyServerMonitor +{ + PGPKeyServerRef keyServerRef; + PGPKeyServerMonitorValues * valuesHead; +} PGPKeyServerMonitor; + + +typedef struct PGPKeyServerThreadStorage * PGPKeyServerThreadStorageRef; +# define kInvalidPGPKeyServerThreadStorageRef \ + ((PGPKeyServerThreadStorageRef) NULL) +#define PGPKeyServerThreadStorageRefIsValid(ref) \ + ((ref) != kInvalidPGPKeyServerThreadStorageRef) + +#if PGP_DEPRECATED /* [ */ + +#define kPGPKeyServerType_Invalid kPGPKeyServerProtocol_Invalid +#define kPGPKeyServerType_LDAP kPGPKeyServerProtocol_LDAP +#define kPGPKeyServerType_HTTP kPGPKeyServerProtocol_HTTP +#define kPGPKeyServerType_LDAPS kPGPKeyServerProtocol_LDAPS +#define kPGPKeyServerType_HTTPS kPGPKeyServerProtocol_HTTPS + +typedef PGPKeyServerProtocol PGPKeyServerType; + +#endif /* ] PGP_DEPRECATED */ + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + + +/* Use the idle event handler to receive periodic idle events during + network calls. Usually this is used only in non-preemptive multi-tasking + OSes to allow yielding in threads. Pre-emptive multi-tasking systems + should probably not use the call as it interrupts the efficient wait state + of threads waiting on network calls. + + Idle event handlers need to be added on a per thread basis. + + Returning an error from the idle event handler will cause the keyserver + to quit processing and to return a kPGPError_UserAbort. */ +PGPError PGPSetKeyServerIdleEventHandler( + PGPEventHandlerProcPtr inCallback, + PGPUserValue inUserData); + +PGPError PGPGetKeyServerIdleEventHandler( + PGPEventHandlerProcPtr * outCallback, + PGPUserValue * outUserData); + +/* Network library options */ + +PGPOptionListRef PGPONetURL(PGPContextRef context, const char *url); + +PGPOptionListRef PGPONetHostName(PGPContextRef context, + const char *hostName, PGPUInt16 port); + +PGPOptionListRef PGPONetHostAddress(PGPContextRef context, + PGPUInt32 hostAddress, PGPUInt16 port); + +PGPOptionListRef PGPOKeyServerProtocol(PGPContextRef context, + PGPKeyServerProtocol serverProtocol); + +PGPOptionListRef PGPOKeyServerKeySpace(PGPContextRef context, + PGPKeyServerKeySpace serverSpace); + +PGPOptionListRef PGPOKeyServerAccessType(PGPContextRef context, + PGPKeyServerAccessType accessType); + +PGPOptionListRef PGPOKeyServerCAKey(PGPContextRef context, + PGPKeyRef caKey); + +PGPOptionListRef PGPOKeyServerRequestKey(PGPContextRef context, + PGPKeyRef requestKey); + +PGPOptionListRef PGPOKeyServerSearchKey(PGPContextRef context, + PGPKeyRef searchKey); + +PGPOptionListRef PGPOKeyServerSearchFilter(PGPContextRef context, + PGPFilterRef searchFilter); + +/* Static storage creation */ +PGPError PGPKeyServerCreateThreadStorage( + PGPKeyServerThreadStorageRef * outPreviousStorage); +PGPError PGPKeyServerDisposeThreadStorage( + PGPKeyServerThreadStorageRef inPreviousStorage); + +/* Initialize and close the keyserver library */ +PGPError PGPKeyServerInit(void); + +PGPError PGPKeyServerCleanup(void); + + +/* Creating and freeing a keyserver ref. */ +PGPError PGPNewKeyServer( + PGPContextRef inContext, + PGPKeyServerClass inClass, + PGPKeyServerRef *outKeyServerRef, + PGPOptionListRef firstOption, + ... ); + +PGPError PGPFreeKeyServer(PGPKeyServerRef inKeyServerRef); +PGPError PGPIncKeyServerRefCount(PGPKeyServerRef inKeyServerRef); + + +/* Set and get the keyserver's event handler. Note that returning an error + for a keyserver event will abort the current call. */ +PGPError PGPSetKeyServerEventHandler( + PGPKeyServerRef inKeyServerRef, + PGPEventHandlerProcPtr inCallback, + PGPUserValue inUserData); + +PGPError PGPGetKeyServerEventHandler( + PGPKeyServerRef inKeyServerRef, + PGPEventHandlerProcPtr * outCallback, + PGPUserValue * outUserData); + + +/* Canceling a call to a keyserver. This is the only call that can be made + to a keyserver that is currently in another call. Also, once you have + returned from a canceled call, you may only close the keyserver. */ +PGPError PGPCancelKeyServerCall(PGPKeyServerRef inKeyServerRef); + + +/* Opening and closing the keyserver. A keyserver ref can be opened and + closed multiple times as necessary. */ +PGPError PGPKeyServerOpen(PGPKeyServerRef inKeyServerRef, + PGPtlsSessionRef inTLSSessionRef); + +PGPError PGPKeyServerClose(PGPKeyServerRef inKeyServerRef); + + +/* Get keyserver info. */ +PGPError PGPGetKeyServerTLSSession(PGPKeyServerRef inKeyServerRef, + PGPtlsSessionRef * outTLSSessionRef); + +PGPError PGPGetKeyServerProtocol(PGPKeyServerRef inKeyServerRef, + PGPKeyServerProtocol * outType); + +PGPError PGPGetKeyServerAccessType(PGPKeyServerRef inKeyServerRef, + PGPKeyServerAccessType * outAccessType); + +PGPError PGPGetKeyServerKeySpace(PGPKeyServerRef inKeyServerRef, + PGPKeyServerKeySpace * outKeySpace); + +PGPError PGPGetKeyServerPort(PGPKeyServerRef inKeyServerRef, + PGPUInt16 * outPort); + +PGPError PGPGetKeyServerHostName(PGPKeyServerRef inKeyServerRef, + char ** outHostName); /* Use PGPFreeData to free */ + +PGPError PGPGetKeyServerAddress(PGPKeyServerRef inKeyServerRef, + PGPUInt32 * outAddress); + +PGPError PGPGetKeyServerPath(PGPKeyServerRef inKeyServerRef, + char ** outPath); /* Use PGPFreeData to free */ + +PGPContextRef PGPGetKeyServerContext(PGPKeyServerRef inKeyServerRef); + +/* If there was an error string returned from the server, you can get it with + this function. Note that if there is no string, the function will return + kPGPError_NoErr and *outErrorString will be NULL */ +PGPError PGPGetLastKeyServerErrorString( + PGPKeyServerRef inKeyServerRef, + char ** outErrorString); /* Use PGPFreeData to free */ + + +/* These functions may be used with both HTTP and LDAP keyservers */ +PGPError PGPQueryKeyServer(PGPKeyServerRef inKeyServerRef, + PGPFilterRef inFilterRef, + PGPKeySetRef * outFoundKeys); + +PGPError PGPUploadToKeyServer(PGPKeyServerRef inKeyServerRef, + PGPKeySetRef inKeysToUpload, + PGPKeySetRef * outKeysThatFailed); + + +/* These functions may only be used with LDAP keyservers */ +PGPError PGPDeleteFromKeyServer(PGPKeyServerRef inKeyServerRef, + PGPKeySetRef inKeysToDelete, + PGPKeySetRef * outKeysThatFailed); + +PGPError PGPDisableFromKeyServer(PGPKeyServerRef inKeyServerRef, + PGPKeySetRef inKeysToDisable, + PGPKeySetRef * outKeysThatFailed); + +PGPError PGPSendGroupsToServer(PGPKeyServerRef inKeyServerRef, + PGPGroupSetRef inGroupSetRef); + +PGPError PGPRetrieveGroupsFromServer( + PGPKeyServerRef inKeyServerRef, + PGPGroupSetRef * outGroupSetRef); + +PGPError PGPNewServerMonitor(PGPKeyServerRef inKeyServerRef, + PGPKeyServerMonitor ** outMonitor); + +PGPError PGPFreeServerMonitor(PGPKeyServerMonitor * inMonitor); + +/* X.509 Certificate Request functions */ + +PGPError PGPSendCertificateRequest( + PGPKeyServerRef inKeyServerRef, + PGPOptionListRef firstOption, + ... ); + +PGPError PGPRetrieveCertificate( + PGPKeyServerRef inKeyServerRef, + PGPOptionListRef firstOption, + ... ); + +PGPError PGPRetrieveCertificateRevocationList( + PGPKeyServerRef inKeyServerRef, + PGPOptionListRef firstOption, + ... ); + +/*************************************************************************** +**************************************************************************** + NOTE: These functions are deprecated and should not be used + + PGPGetKeyServerType -> PGPGetKeyServerProtocol + PGPNewKeyServerFromURL -> PGPNewKeyServer + PGPNewKeyServerFromHostName -> PGPNewKeyServer + PGPNewKeyServerFromHostAddress -> PGPNewKeyServer + +**************************************************************************** +***************************************************************************/ + +#if PGP_DEPRECATED /* [ */ + +PGPError PGPNewKeyServerFromURL(PGPContextRef inContext, + const char * inURL, + PGPKeyServerAccessType inAccessType, + PGPKeyServerKeySpace inKeySpace, + PGPKeyServerRef * outKeyServerRef); + +PGPError PGPNewKeyServerFromHostName(PGPContextRef inContext, + const char * inHostName, + PGPUInt16 inPort, /* default for protocol if 0 */ + PGPKeyServerProtocol inType, + PGPKeyServerAccessType inAccessType, + PGPKeyServerKeySpace inKeySpace, + PGPKeyServerRef * outKeyServerRef); + +PGPError PGPNewKeyServerFromHostAddress(PGPContextRef inContext, + PGPUInt32 inAddress, + PGPUInt16 inPort, /* default for protocol if 0 */ + PGPKeyServerProtocol inType, + PGPKeyServerAccessType inAccessType, + PGPKeyServerKeySpace inKeySpace, + PGPKeyServerRef * outKeyServerRef); + +PGPError PGPGetKeyServerType(PGPKeyServerRef inKeyServerRef, + PGPKeyServerType * outType); + +#endif /* ] PGP_DEPRECATED */ + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + +#endif diff --git a/cryptopp/PGPw/sdk6/include/pgpKeys.h b/cryptopp/PGPw/sdk6/include/pgpKeys.h new file mode 100644 index 0000000..8bfdc34 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpKeys.h @@ -0,0 +1,879 @@ +/*____________________________________________________________________________ + pgpKeys.h + + Copyright(C) 1996,1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + Public definitions for PGP KeyDB Library + + $Id: pgpKeys.h,v 1.132 1999/05/18 19:38:45 heller Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpKeys_h /* [ */ +#define Included_pgpKeys_h + + + +#include "pgpPubTypes.h" +#include "pgpHash.h" +#include "pgpOptionList.h" + + + +/* Key ordering */ +enum PGPKeyOrdering_ +{ + kPGPInvalidOrdering = 0, + kPGPAnyOrdering = 1, + kPGPUserIDOrdering = 2, + kPGPReverseUserIDOrdering = 3, + kPGPKeyIDOrdering = 4, + kPGPReverseKeyIDOrdering = 5, + kPGPValidityOrdering = 6, + kPGPReverseValidityOrdering = 7, + kPGPTrustOrdering = 8, + kPGPReverseTrustOrdering = 9, + kPGPEncryptKeySizeOrdering = 10, + kPGPReverseEncryptKeySizeOrdering = 11, + kPGPSigKeySizeOrdering = 12, + kPGPReverseSigKeySizeOrdering = 13, + kPGPCreationOrdering = 14, + kPGPReverseCreationOrdering = 15, + kPGPExpirationOrdering = 16, + kPGPReverseExpirationOrdering = 17, + + PGP_ENUM_FORCE( PGPKeyOrdering_ ) +} ; +PGPENUM_TYPEDEF( PGPKeyOrdering_, PGPKeyOrdering ); + + + +/* Key properties */ + +enum PGPKeyPropName_ +{ +/* String properties */ + kPGPKeyPropFingerprint = 1, + kPGPKeyPropPreferredAlgorithms = 2, + kPGPKeyPropThirdPartyRevocationKeyID= 3, + kPGPKeyPropKeyData = 4, + kPGPKeyPropX509MD5Hash = 5, + + /* Number properties */ + kPGPKeyPropAlgID = 20, + kPGPKeyPropBits = 21, + kPGPKeyPropTrust = 22, /* old trust model only */ + kPGPKeyPropValidity = 23, /* both trust models */ + kPGPKeyPropLockingAlgID = 24, + kPGPKeyPropLockingBits = 25, + kPGPKeyPropFlags = 26, + + /* Time properties */ + kPGPKeyPropCreation = 40, + kPGPKeyPropExpiration = 41, + kPGPKeyPropCRLThisUpdate = 42, + kPGPKeyPropCRLNextUpdate = 43, + + /* PGPBoolean properties */ + kPGPKeyPropIsSecret = 60, + kPGPKeyPropIsAxiomatic = 61, + kPGPKeyPropIsRevoked = 62, + kPGPKeyPropIsDisabled = 63, + kPGPKeyPropIsNotCorrupt = 64, + kPGPKeyPropIsExpired = 65, + kPGPKeyPropNeedsPassphrase = 66, + kPGPKeyPropHasUnverifiedRevocation = 67, + kPGPKeyPropCanEncrypt = 68, + kPGPKeyPropCanDecrypt = 69, + kPGPKeyPropCanSign = 70, + kPGPKeyPropCanVerify = 71, + kPGPKeyPropIsEncryptionKey = 72, + kPGPKeyPropIsSigningKey = 73, + kPGPKeyPropIsSecretShared = 74, + kPGPKeyPropIsRevocable = 75, + kPGPKeyPropHasThirdPartyRevocation = 76, + kPGPKeyPropHasCRL = 77, + + PGP_ENUM_FORCE( PGPKeyPropName_ ) +} ; +PGPENUM_TYPEDEF( PGPKeyPropName_, PGPKeyPropName ); + + +/* kPGPKeyPropFlags bits */ +enum /* PGPKeyPropFlags */ +{ + kPGPKeyPropFlags_UsageSignUserIDs = (1UL << 0 ), + kPGPKeyPropFlags_UsageSignMessages = (1UL << 1 ), + kPGPKeyPropFlags_UsageEncryptCommunications = (1UL << 2 ), + kPGPKeyPropFlags_UsageEncryptStorage = (1UL << 3 ), + + kPGPKeyPropFlags_PrivateSplit = (1UL << 4 ), + kPGPKeyPropFlags_PrivateShared = (1UL << 7 ) +} ; +typedef PGPFlags PGPKeyPropFlags; + + + +/* User ID properties */ + +enum PGPUserIDPropName_ +{ + /* String properties */ + kPGPUserIDPropName = 80, + kPGPUserIDPropAttributeData = 81, + kPGPUserIDPropCommonName = 82, + kPGPUserIDPropEmailAddress = 83, + + /* Number properties */ + kPGPUserIDPropValidity = 100, /* both trust models */ + kPGPUserIDPropConfidence = 101, /* new trust model only */ + kPGPUserIDPropAttributeType = 102, + + /* Time properties */ + + /* PGPBoolean properties */ + kPGPUserIDPropIsAttribute = 110, + + PGP_ENUM_FORCE( PGPUserIDPropName_ ) +} ; +PGPENUM_TYPEDEF( PGPUserIDPropName_, PGPUserIDPropName ); + +/* Signature properties */ + +enum PGPSigPropName_ +{ + /* String properties */ + kPGPSigPropKeyID = 120, + kPGPSigPropX509Certificate = 121, + kPGPSigPropX509IASN = 122, + kPGPSigPropX509LongName = 123, + kPGPSigPropX509IssuerLongName = 124, + kPGPSigPropX509DNSName = 125, + kPGPSigPropX509IPAddress = 126, + kPGPSigPropX509DERDName = 127, + + /* Number properties */ + kPGPSigPropAlgID = 140, + kPGPSigPropTrustLevel = 141, + kPGPSigPropTrustValue = 142, + + /* Time properties */ + kPGPSigPropCreation = 160, + kPGPSigPropExpiration = 161, + + /* PGPBoolean properties */ + kPGPSigPropIsRevoked = 180, + kPGPSigPropIsNotCorrupt = 181, + kPGPSigPropIsTried = 182, + kPGPSigPropIsVerified = 183, + kPGPSigPropIsMySig = 184, + kPGPSigPropIsExportable = 185, + kPGPSigPropHasUnverifiedRevocation = 186, + kPGPSigPropIsExpired = 187, + kPGPSigPropIsX509 = 188, + + PGP_ENUM_FORCE( PGPSigPropName_ ) +} ; +PGPENUM_TYPEDEF( PGPSigPropName_, PGPSigPropName ); +/* + * Note on kPGPSigPropIsMySig. 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 + * PGPGetSigCertifierKey( certset, signerset, &key) followed by + * PGPGetKeyBoolean( key, kPGPKeyPropIsSecret, &secret). + */ + + +/* Attribute types, for use with kPGPUserIDPropAttributeType */ +enum PGPAttributeType_ +{ + kPGPAttribute_Image = 1, + kPGPAttribute_IPAddress = 10, + kPGPAttribute_DNSName = 11, + kPGPAttribute_Notation = 20, + + PGP_ENUM_FORCE( PGPAttributeType_ ) +} ; +PGPENUM_TYPEDEF( PGPAttributeType_, PGPAttributeType ); + + +enum /* PGPKeyRingOpenFlags */ +{ + kPGPKeyRingOpenFlags_None = 0, + kPGPKeyRingOpenFlags_Reserved = (1UL << 0 ), + kPGPKeyRingOpenFlags_Mutable = (1UL << 1 ), + kPGPKeyRingOpenFlags_Create = (1UL << 2 ), + + /* The following flags are only used by PGPOpenKeyRing */ + kPGPKeyRingOpenFlags_Private = (1UL << 8 ), + kPGPKeyRingOpenFlags_Trusted = (1UL << 9 ) +} ; +typedef PGPFlags PGPKeyRingOpenFlags; + +/* + * Used by filtering functions to specify type of match. + */ + +enum PGPMatchCriterion_ +{ + kPGPMatchDefault = 1, + kPGPMatchEqual = 1, /* searched val == supplied val */ + kPGPMatchGreaterOrEqual = 2, /* searched val >= supplied val */ + kPGPMatchLessOrEqual = 3, /* searched val <= supplied val */ + kPGPMatchSubString = 4, /* searched val is contained in supplied val */ + + PGP_ENUM_FORCE( PGPMatchCriterion_ ) +} ; +PGPENUM_TYPEDEF( PGPMatchCriterion_, PGPMatchCriterion ); + + +/* This is the value of the expiration time which means "never expires" */ +#define kPGPExpirationTime_Never ( (PGPTime)0 ) + +/* Secret sharing header size */ +#define kPGPShareHeaderSize 4 + +/* Public entry points */ + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + + +/* Functions for setting up key filters. */ + +PGPError PGPIncFilterRefCount ( PGPFilterRef filter ); + +PGPError PGPFreeFilter ( PGPFilterRef filter ); + +PGPError PGPNewKeyIDFilter( PGPContextRef context, + PGPKeyID const * keyID, PGPFilterRef *outFilter); + +PGPError PGPNewSubKeyIDFilter( PGPContextRef context, + PGPKeyID const * subKeyID, + PGPFilterRef * outFilter); + +PGPError PGPNewKeyEncryptAlgorithmFilter( PGPContextRef context, + PGPPublicKeyAlgorithm encryptAlgorithm, + PGPFilterRef *outFilter ); + +PGPError PGPNewKeyFingerPrintFilter( PGPContextRef context, + void const *fingerPrint, + PGPSize fingerPrintLength, PGPFilterRef *outFilter ); + +PGPError PGPNewKeyCreationTimeFilter( PGPContextRef context, + PGPTime creationTime, PGPMatchCriterion match, + PGPFilterRef *outFilter ); + +PGPError PGPNewKeyExpirationTimeFilter( PGPContextRef context, + PGPTime expirationTime, + PGPMatchCriterion match, PGPFilterRef *outFilter ); + +PGPError PGPNewKeyRevokedFilter( PGPContextRef context, + PGPBoolean revoked, PGPFilterRef *outFilter ); + +PGPError PGPNewKeyDisabledFilter( PGPContextRef context, + PGPBoolean disabled, + PGPFilterRef * outFilter); + +PGPError PGPNewKeySigAlgorithmFilter( PGPContextRef context, + PGPPublicKeyAlgorithm sigAlgorithm, + PGPFilterRef *outFilter ); + +PGPError PGPNewKeyEncryptKeySizeFilter( PGPContextRef context, + PGPUInt32 keySize, PGPMatchCriterion match, + PGPFilterRef *outFilter ); + +PGPError PGPNewKeySigKeySizeFilter( PGPContextRef context, + PGPUInt32 keySize, PGPMatchCriterion match, + PGPFilterRef *outFilter ); + +PGPError PGPNewUserIDStringFilter( PGPContextRef context, + char const * userIDString, + PGPMatchCriterion match, + PGPFilterRef * outFilter); + +PGPError PGPNewUserIDEmailFilter( PGPContextRef context, + char const * emailString, + PGPMatchCriterion match, + PGPFilterRef * outFilter); + +PGPError PGPNewUserIDNameFilter( PGPContextRef context, + char const * nameString, + PGPMatchCriterion match, + PGPFilterRef * outFilter); + +PGPError PGPNewSigKeyIDFilter( PGPContextRef context, + PGPKeyID const * keyID, + PGPFilterRef *outFilter ); + +PGPError PGPNewKeyBooleanFilter( PGPContextRef context, + PGPKeyPropName property, PGPBoolean match, + PGPFilterRef *outFilter ); + +PGPError PGPNewKeyNumberFilter( PGPContextRef context, + PGPKeyPropName property, PGPUInt32 value, + PGPMatchCriterion match, PGPFilterRef *outFilter ); + +PGPError PGPNewKeyTimeFilter( PGPContextRef context, + PGPKeyPropName property, PGPTime value, + PGPMatchCriterion match, PGPFilterRef *outFilter ); + +PGPError PGPNewKeyPropertyBufferFilter( PGPContextRef context, + PGPKeyPropName property, void *buffer, PGPSize length, + PGPMatchCriterion match, PGPFilterRef *outFilter ); + +PGPError PGPNewSubKeyBooleanFilter( PGPContextRef context, + PGPKeyPropName property, PGPBoolean match, + PGPFilterRef *outFilter ); + +PGPError PGPNewSubKeyNumberFilter( PGPContextRef context, + PGPKeyPropName property, PGPUInt32 value, + PGPMatchCriterion match, PGPFilterRef *outFilter ); + +PGPError PGPNewSubKeyTimeFilter( PGPContextRef context, + PGPKeyPropName property, PGPTime value, + PGPMatchCriterion match, PGPFilterRef *outFilter ); + +PGPError PGPNewSubKeyPropertyBufferFilter( PGPContextRef context, + PGPKeyPropName property, void *buffer, PGPSize length, + PGPMatchCriterion match, PGPFilterRef *outFilter ); + +PGPError PGPNewUserIDBooleanFilter( PGPContextRef context, + PGPUserIDPropName property, PGPBoolean match, + PGPFilterRef *outFilter ); + +PGPError PGPNewUserIDNumberFilter( PGPContextRef context, + PGPUserIDPropName property, PGPUInt32 value, + PGPMatchCriterion match, PGPFilterRef *outFilter ); + +PGPError PGPNewUserIDStringBufferFilter( PGPContextRef context, + PGPUserIDPropName property, + void *buffer, PGPSize length, + PGPMatchCriterion match, PGPFilterRef *outFilter ); + +PGPError PGPNewSigBooleanFilter( PGPContextRef context, + PGPSigPropName property, PGPBoolean match, + PGPFilterRef *outFilter ); + +PGPError PGPNewSigNumberFilter( PGPContextRef context, + PGPSigPropName property, PGPUInt32 value, + PGPMatchCriterion match, PGPFilterRef *outFilter ); + +PGPError PGPNewSigTimeFilter( PGPContextRef context, + PGPSigPropName property, PGPTime value, + PGPMatchCriterion match, PGPFilterRef *outFilter ); + +PGPError PGPNewSigPropertyBufferFilter( PGPContextRef context, + PGPSigPropName property, void *buffer, PGPSize length, + PGPMatchCriterion match, PGPFilterRef *outFilter ); + +/* freeing outfilter will call PGPFreeFilter on filter */ +PGPError PGPNegateFilter( PGPFilterRef filter, + PGPFilterRef *outFilter); + +/* freeing outfilter will call PGPFreeFilter on filter1, filter2 */ +PGPError PGPIntersectFilters( PGPFilterRef filter1, + PGPFilterRef filter2, PGPFilterRef *outFilter); + +/* freeing outfilter will call PGPFreeFilter on filter1, filter2 */ +PGPError PGPUnionFilters( PGPFilterRef filter1, + PGPFilterRef filter2, PGPFilterRef *outFilter); + + +PGPError PGPFilterKeySet( PGPKeySetRef origSet, + PGPFilterRef filter, PGPKeySetRef *resultSet); + + +/* Keyserver filter functions */ + +PGPError PGPLDAPQueryFromFilter( PGPFilterRef filter, + char **queryOut ); + +PGPError PGPHKSQueryFromFilter( PGPFilterRef filter, + char **queryOut ); + +PGPError PGPNetToolsCAHTTPQueryFromFilter( PGPFilterRef filter, + char **queryOut ); + +/* KeySet manipulations */ + + +/* Creates a new memory-based KeyDB and returns its root set */ +PGPError PGPNewKeySet(PGPContextRef context, PGPKeySetRef *keySet); + + +/* Used for building arbitrary subsets of an existing KeyDB */ +PGPError PGPNewEmptyKeySet(PGPKeySetRef origSet, PGPKeySetRef *newSet); +PGPError PGPNewSingletonKeySet(PGPKeyRef key, PGPKeySetRef *keySet); +PGPError PGPUnionKeySets(PGPKeySetRef set1, PGPKeySetRef set2, + PGPKeySetRef *newSet); + +PGPError PGPOpenDefaultKeyRings( PGPContextRef context, + PGPKeyRingOpenFlags openFlags, PGPKeySetRef *keySet); + +PGPError PGPOpenKeyRingPair( PGPContextRef context, + PGPKeyRingOpenFlags openFlags, + PGPFileSpecRef pubFileRef, PGPFileSpecRef secFileRef, + PGPKeySetRef *keySet); + +PGPError PGPOpenKeyRing (PGPContextRef context, + PGPKeyRingOpenFlags openFlags, PGPFileSpecRef fileRef, + PGPKeySetRef *keySet); + +PGPError PGPCommitKeyRingChanges (PGPKeySetRef keys); + +PGPError PGPPropagateTrust (PGPKeySetRef keys); + +PGPError PGPRevertKeyRingChanges (PGPKeySetRef keys); + +PGPError PGPCheckKeyRingSigs (PGPKeySetRef keysToCheck, + PGPKeySetRef keysSigning, PGPBoolean checkAll, + PGPEventHandlerProcPtr eventHandler, + PGPUserValue eventHandlerData); + +PGPError PGPReloadKeyRings (PGPKeySetRef keys); + +PGPError PGPGetKeyByKeyID (PGPKeySetRef keys, + PGPKeyID const * keyID, + PGPPublicKeyAlgorithm pubKeyAlgorithm, + PGPKeyRef *outRef); + +PGPBoolean PGPKeySetIsMember(PGPKeyRef key, PGPKeySetRef set); + +PGPError PGPCountKeys( PGPKeySetRef keys, PGPUInt32 *numKeys); + +PGPError PGPIncKeySetRefCount( PGPKeySetRef keys); + +PGPError PGPFreeKeySet( PGPKeySetRef keys); + +PGPBoolean PGPKeySetIsMutable( PGPKeySetRef keys); + +PGPBoolean PGPKeySetNeedsCommit( PGPKeySetRef keys); + + +PGPError PGPAddKeys( PGPKeySetRef keysToAdd, PGPKeySetRef set ); + +PGPError PGPRemoveKeys( PGPKeySetRef keysToRemove, PGPKeySetRef set ); + + + +/* Key manipulation functions */ + +PGPError PGPDisableKey( PGPKeyRef key); + +PGPError PGPEnableKey( PGPKeyRef key); + +PGPError PGPRemoveSubKey( PGPSubKeyRef subkey); + +PGPError PGPRemoveUserID( PGPUserIDRef userID); + +PGPError PGPSetPrimaryUserID( PGPUserIDRef userid); + +PGPError PGPCertifyPrimaryUserID( PGPUserIDRef userid, + PGPOptionListRef firstOption, ...); + +PGPError PGPGetSigCertifierKey( PGPSigRef cert, PGPKeySetRef allkeys, + PGPKeyRef *certkey); + +PGPError PGPGetSigX509CertifierSig( PGPSigRef cert, + PGPKeySetRef allkeys, PGPSigRef *certsig); + +PGPError PGPRemoveSig( PGPSigRef cert); + +PGPError PGPCountAdditionalRecipientRequests( PGPKeyRef basekey, + PGPUInt32 * numARKeys); + +PGPError PGPGetIndexedAdditionalRecipientRequestKey( + PGPKeyRef basekey, PGPKeySetRef allkeys, PGPUInt32 nth, + PGPKeyRef *arkey, PGPKeyID *arkeyid, + PGPByte *arclass ); + +PGPError PGPCountRevocationKeys( PGPKeyRef basekey, + PGPUInt32 * numRevKeys); + +PGPError PGPGetIndexedRevocationKey( + PGPKeyRef basekey, PGPKeySetRef allkeys, PGPUInt32 nth, + PGPKeyRef *revkey, PGPKeyID *revkeyid ); +PGPError PGPGetCRLDistributionPoints( + PGPKeyRef cakey, PGPKeySetRef keyset, + PGPUInt32 *pnDistPoints, PGPByte **pDpoints, + PGPSize **pdpointLengths ); + + +/* Wrapper functions */ +PGPError PGPGenerateKey( PGPContextRef context, PGPKeyRef *key, + PGPOptionListRef firstOption, ...); +PGPError PGPGenerateSubKey( PGPContextRef context, + PGPSubKeyRef *subkey, + PGPOptionListRef firstOption, ...); +PGPUInt32 PGPGetKeyEntropyNeeded( PGPContextRef context, + PGPOptionListRef firstOption, ...); +PGPError PGPExportKeySet( PGPKeySetRef keys, + PGPOptionListRef firstOption, ...); +PGPError PGPExport( PGPContextRef context, + PGPOptionListRef firstOption, ...); +PGPError PGPImportKeySet( PGPContextRef context, + PGPKeySetRef *keys, + PGPOptionListRef firstOption, ...); +PGPError PGPSignUserID( PGPUserIDRef userID, + PGPKeyRef certifyingKey, + PGPOptionListRef firstOption, ...); +PGPError PGPAddUserID( PGPKeyRef key, char const *userID, + PGPOptionListRef firstOption, ...); +PGPError PGPAddAttributeUserID( PGPKeyRef key, + PGPAttributeType attributeType, + PGPByte *attributeData, PGPSize attributeLength, + PGPOptionListRef firstOption, ...); +PGPError PGPRevokeSig( PGPSigRef cert, PGPKeySetRef allkeys, + PGPOptionListRef firstOption, ...); +PGPError PGPRevokeKey( PGPKeyRef key, + PGPOptionListRef firstOption, ...); +PGPError PGPRevokeSubKey( PGPSubKeyRef subkey, + PGPOptionListRef firstOption, ...); +PGPError PGPChangePassphrase( PGPKeyRef key, + PGPOptionListRef firstOption, ...); +PGPError PGPChangeSubKeyPassphrase( PGPSubKeyRef subkey, + PGPOptionListRef firstOption, ...); +PGPBoolean PGPPassphraseIsValid( PGPKeyRef key, + PGPOptionListRef firstOption, ...); +PGPError PGPSetKeyAxiomatic( PGPKeyRef key, + PGPOptionListRef firstOption, ...); + + + +/* + * Trust values for PGPSetKeyTrust and kPGPKeyPropTrust property: + * + * kPGPKeyTrust_Undefined (do not pass to PGPSetKeyTrust) + * kPGPKeyTrust_Unknown (unknown) + * kPGPKeyTrust_Never (never) + * kPGPKeyTrust_Marginal (sometimes) + * kPGPKeyTrust_Complete (always) + * kPGPKeyTrust_Ultimate (do not pass to PGPSetKeyTrust) + */ + + /* old trust model */ +PGPError PGPSetKeyTrust( PGPKeyRef key, PGPUInt32 trust); + +PGPError PGPUnsetKeyAxiomatic( PGPKeyRef key); + +/* Get property functions */ + +PGPError PGPGetKeyBoolean( PGPKeyRef key, PGPKeyPropName propname, + PGPBoolean *prop); + +PGPError PGPGetKeyNumber( PGPKeyRef key, PGPKeyPropName propname, + PGPInt32 *prop); + +/* 'buffer' is NOT null-terminated */ +/* returns kPGPError_BufferTooSmall if buffer is too small, but +fill buffer to capacity */ +PGPError PGPGetKeyPropertyBuffer( PGPKeyRef key, + PGPKeyPropName propname, + PGPSize bufferSize, void *data, PGPSize *fullSize); + +PGPError PGPGetKeyTime( PGPKeyRef key, PGPKeyPropName propname, + PGPTime *prop); + +PGPError PGPGetSubKeyBoolean( PGPSubKeyRef subkey, + PGPKeyPropName propname, PGPBoolean *prop); + +PGPError PGPGetSubKeyNumber( PGPSubKeyRef subkey, + PGPKeyPropName propname, PGPInt32 *prop); + +/* returns kPGPError_BufferTooSmall if buffer is too small, but +fill buffer to capacity */ +PGPError PGPGetSubKeyPropertyBuffer( PGPSubKeyRef subkey, + PGPKeyPropName propname, + PGPSize bufferSize, void *prop, PGPSize *fullSize); + +PGPError PGPGetSubKeyTime( PGPSubKeyRef subkey, + PGPKeyPropName propname, PGPTime *prop); + +PGPError PGPGetUserIDNumber( PGPUserIDRef userID, + PGPUserIDPropName propname, PGPInt32 *prop); + +PGPError PGPGetUserIDBoolean( PGPUserIDRef userID, + PGPUserIDPropName propname, PGPBoolean *prop); + +/* 'string' is always NULL-terminated */ +/* returns kPGPError_BufferTooSmall if buffer is too small, but +fill buffer to capacity */ +PGPError PGPGetUserIDStringBuffer( PGPUserIDRef userID, + PGPUserIDPropName propname, + PGPSize bufferSize, + char * string, + PGPSize * fullSize); + +/* 'buffer' is NOT null-terminated */ +/* returns kPGPError_BufferTooSmall if buffer is too small, but +fill buffer to capacity */ +PGPError PGPGetSigPropertyBuffer( PGPSigRef cert, + PGPSigPropName propname, + PGPSize bufferSize, void *data, PGPSize *fullSize); + +PGPError PGPGetSigBoolean( PGPSigRef cert, + PGPSigPropName propname, PGPBoolean *prop); + +PGPError PGPGetSigNumber( PGPSigRef cert, PGPSigPropName propname, + PGPInt32 *prop); + +PGPError PGPGetKeyIDOfCertifier( PGPSigRef sig, PGPKeyID *outID ); + +PGPError PGPGetSigTime( PGPSigRef cert, PGPSigPropName propname, + PGPTime *prop); + +PGPError PGPGetHashAlgUsed( PGPKeyRef key, PGPHashAlgorithm *hashAlg); + +/* Convenience property functions */ + +PGPError PGPGetPrimaryUserID( PGPKeyRef key, PGPUserIDRef *outRef ); +PGPError PGPGetPrimaryAttributeUserID (PGPKeyRef key, + PGPAttributeType attributeType, PGPUserIDRef *outRef); + +/* 'string' is always a C string and + *fullSize includes the '\0' terminator */ +/* returns kPGPError_BufferTooSmall if buffer is too small, but +fill buffer to capacity */ +PGPError PGPGetPrimaryUserIDNameBuffer( PGPKeyRef key, + PGPSize bufferSize, + char * string, PGPSize *fullSize ); + +PGPError PGPGetPrimaryUserIDValidity(PGPKeyRef key, + PGPValidity *validity); + + +PGPInt32 PGPCompareKeys(PGPKeyRef a, PGPKeyRef b, + PGPKeyOrdering order); + +PGPInt32 PGPCompareUserIDStrings(char const *a, char const *b); + +PGPError PGPOrderKeySet( PGPKeySetRef src, + PGPKeyOrdering order, PGPKeyListRef *outRef ); + +PGPError PGPIncKeyListRefCount( PGPKeyListRef keys); + +PGPError PGPFreeKeyList( PGPKeyListRef keys); + + +/* Key iteration functions */ + + + +PGPError PGPNewKeyIter (PGPKeyListRef keys, PGPKeyIterRef *outRef); + +PGPError PGPCopyKeyIter (PGPKeyIterRef orig, PGPKeyIterRef *outRef); + +PGPError PGPFreeKeyIter (PGPKeyIterRef iter); + +PGPInt32 PGPKeyIterIndex (PGPKeyIterRef iter); + +PGPError PGPKeyIterRewind (PGPKeyIterRef iter); + +PGPInt32 PGPKeyIterSeek (PGPKeyIterRef iter, PGPKeyRef key); + +PGPError PGPKeyIterMove (PGPKeyIterRef iter, PGPInt32 relOffset, + PGPKeyRef *outRef); + +PGPError PGPKeyIterNext (PGPKeyIterRef iter, PGPKeyRef *outRef); + +PGPError PGPKeyIterPrev (PGPKeyIterRef iter, PGPKeyRef *outRef); + +PGPError PGPKeyIterKey (PGPKeyIterRef iter, PGPKeyRef *outRef); + +PGPError PGPKeyIterSubKey (PGPKeyIterRef iter, + PGPSubKeyRef *outRef ); + +PGPError PGPKeyIterUserID (PGPKeyIterRef iter, + PGPUserIDRef *outRef ); +PGPError PGPKeyIterSig (PGPKeyIterRef iter, + PGPSigRef *outRef ); + +PGPError PGPKeyIterNextSubKey (PGPKeyIterRef iter, + PGPSubKeyRef *outRef ); + +PGPError PGPKeyIterPrevSubKey (PGPKeyIterRef iter, + PGPSubKeyRef *outRef); + +PGPError PGPKeyIterRewindSubKey (PGPKeyIterRef iter); + +PGPError PGPKeyIterNextUserID (PGPKeyIterRef iter, + PGPUserIDRef *outRef); + +PGPError PGPKeyIterPrevUserID (PGPKeyIterRef iter, + PGPUserIDRef *outRef); + +PGPError PGPKeyIterRewindUserID (PGPKeyIterRef iter); + +PGPError PGPKeyIterNextUIDSig (PGPKeyIterRef iter, + PGPSigRef *outRef); + +PGPError PGPKeyIterPrevUIDSig (PGPKeyIterRef iter, + PGPSigRef *outRef); + +PGPError PGPKeyIterRewindUIDSig (PGPKeyIterRef iter); + + +/* Get/set default private key */ + +PGPError PGPGetDefaultPrivateKey( PGPKeySetRef keyset, + PGPKeyRef *outRef ); + +PGPError PGPSetDefaultPrivateKey( PGPKeyRef key); + + + +/* Get/set user value */ + +PGPError PGPSetKeyUserVal( PGPKeyRef key, PGPUserValue userValue); + +PGPError PGPSetUserIDUserVal( PGPUserIDRef userid, + PGPUserValue userValue); + +PGPError PGPSetSubKeyUserVal( PGPSubKeyRef subkey, + PGPUserValue userValue); + +PGPError PGPSetSigUserVal( PGPSigRef cert, + PGPUserValue userValue); + +PGPError PGPGetKeyUserVal( PGPKeyRef key, + PGPUserValue *userValue); + +PGPError PGPGetUserIDUserVal( PGPUserIDRef userid, + PGPUserValue *userValue); + +PGPError PGPGetSubKeyUserVal( PGPSubKeyRef subkey, + PGPUserValue *userValue); + +PGPError PGPGetSigUserVal( PGPSigRef cert, + PGPUserValue *userValue); + +/* Passphrase conversion to passkeybuffer */ +/* The size of the output buffer is from the kPGPKeyPropLockingBits property */ + +PGPError PGPGetKeyPasskeyBuffer ( PGPKeyRef key, + void *passkeyBuffer, PGPOptionListRef firstOption,...); + +PGPError PGPGetSubKeyPasskeyBuffer ( PGPSubKeyRef subkey, + void *passkeyBuffer, PGPOptionListRef firstOption,...); + + +/* Change key options which are stored in self signatures internally */ + +PGPError PGPAddKeyOptions( PGPKeyRef key, + PGPOptionListRef firstOption, ...); + +PGPError PGPRemoveKeyOptions( PGPKeyRef key, + PGPOptionListRef firstOption, ...); + +PGPError PGPUpdateKeyOptions( PGPKeyRef key, + PGPOptionListRef firstOption, ...); + + + +/*____________________________________________________________________________ + Key IDs +____________________________________________________________________________*/ +PGPError PGPGetKeyIDFromString( + const char *string, PGPKeyID *id ); + +PGPError PGPGetKeyIDFromKey( PGPKeyRef key, PGPKeyID *id ); + +PGPError PGPGetKeyIDFromSubKey( PGPSubKeyRef key, PGPKeyID * id ); + +enum PGPKeyIDStringType_ +{ + kPGPKeyIDString_Abbreviated = 2, + kPGPKeyIDString_Full = 3, + PGP_ENUM_FORCE( PGPKeyIDStringType_ ) +}; +PGPENUM_TYPEDEF( PGPKeyIDStringType_, PGPKeyIDStringType ); + + +#define kPGPMaxKeyIDStringSize ( 127 + 1 ) +PGPError PGPGetKeyIDString( PGPKeyID const * ref, + PGPKeyIDStringType type, + char outString[ kPGPMaxKeyIDStringSize ] ); + + +/* outputs opaque string of bytes for storage of maximum size as keyID*/ +/* do NOT attempt to parse the output; it is opaque to you */ +#define kPGPMaxExportedKeyIDSize ( sizeof( PGPKeyID ) ) +PGPError PGPExportKeyID( PGPKeyID const * keyID, + PGPByte exportedData[ kPGPMaxExportedKeyIDSize ], + PGPSize *exportedLength ); + +/* must be in format output by PGPExportKeyID */ +PGPError PGPImportKeyID( void const * data, PGPKeyID * id ); + +/* returns 0 if equal, -1 if key1 < key2, 1 if key1 > key2 */ +PGPInt32 PGPCompareKeyIDs( PGPKeyID const * key, PGPKeyID const * key2); + + + + +/*____________________________________________________________________________ + Getting contexts back from key related items. If the key is invalid, + you get kPGPInvalidRef back. +____________________________________________________________________________*/ + +PGPContextRef PGPGetKeyListContext( PGPKeyListRef ref ); +PGPContextRef PGPGetKeySetContext( PGPKeySetRef ref ); +PGPContextRef PGPGetKeyIterContext( PGPKeyIterRef ref ); +PGPContextRef PGPGetKeyContext( PGPKeyRef ref ); +PGPContextRef PGPGetSubKeyContext( PGPSubKeyRef ref ); +PGPContextRef PGPGetUserIDContext( PGPUserIDRef ref ); + +/*____________________________________________________________________________ + Getting parent objects from key related items. If the input is invalid, + you get kPGPInvalidRef back. +____________________________________________________________________________*/ +PGPKeyRef PGPGetUserIDKey( PGPUserIDRef ref ); +PGPUserIDRef PGPGetSigUserID( PGPSigRef ref ); +PGPKeyRef PGPGetSigKey( PGPSigRef ref ); + + +/*____________________________________________________________________________ + Secret sharing functionality +____________________________________________________________________________*/ + +PGPError PGPSecretShareData(PGPContextRef context, + void const * input, PGPSize inputBytes, + PGPUInt32 threshold, PGPUInt32 nShares, void * output); + +PGPError PGPSecretReconstructData(PGPContextRef context, + void * input, PGPSize outputBytes, + PGPUInt32 nShares, void * output); + + +/*____________________________________________________________________________ + X509 certificate specific +____________________________________________________________________________*/ + +PGPError PGPVerifyX509CertificateChain (PGPContextRef context, + PGPByte *certchain, PGPByte *rootcerts); + +PGPError PGPCreateDistinguishedName( PGPContextRef context, + char const *str, + PGPByte **pdname, PGPSize *pdnamelen ); + + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + + +#endif /* ] Included_pgpKeys_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpMemoryMgr.h b/cryptopp/PGPw/sdk6/include/pgpMemoryMgr.h new file mode 100644 index 0000000..7480d52 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpMemoryMgr.h @@ -0,0 +1,235 @@ +/*____________________________________________________________________________ + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + Contains the definition of the PGPMemoryMgr object. + + $Id: pgpMemoryMgr.h,v 1.21 1999/05/07 01:55:45 heller Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpMemoryMgr_h /* [ */ +#define Included_pgpMemoryMgr_h + + +#include "pgpBase.h" + +/*____________________________________________________________________________ + Mini-tutorial: + + A PGPMemoryMgr is an object which implements memory management, including + allocation, reallocation, deallocation, and secure versions of the same. + + *** Using it *** + A typical sequence of calls is as follows: + PGPNewMemoryMgr + ... + PGPNewData or PGPNewSecureData + PGPFreeData + ... + PGPFreeMemoryMgr + + Typically, a program will create one PGPMemoryMgr per thread at + thread creation time and use that memory mgr until the thread dies. + Generally, an individual PGPMemoryMgr instance is not thread-safe; + you must either synchronize or use one PGPMemoryMgr per thread. + + + *** Custom Allocators *** + + Default allocators are supplied, but the client can create a custom + PGPMemoryMgr using PGPNewMemoryMgrCustom() which uses client-supplied + routines. + Custom routines need only concern themselves with the actual + allocation and deallocation. + The following should be kept in mind for user supplied routines: + - they can ignore the allocation flags passed + - leaks, memory clearing, etc is done by the PGPMemoryMgr + - secure allocator must set 'isNonPageable' to TRUE only if the + memory really can't be paged. + - the user value is not interpreted by the PGPMemoryMgr. Typically, + it would be a pointer to some data the allocation routines use + to store state. + + + *** Secure memory allocation *** + + Blocks can be allocated as "Secure" blocks. Secure blocks are guaranteed + to be wiped when they are deallocated. Additionally, if the operating + system and the current conditions allow, the block will be allocated + in non-pageable memory. You can determine the attributes of a block using + PGPGetMemoryMgrDataInfo(). + + + *** Leaks tracking *** + + Leaks tracking is implemented when debugging is on, + but currently reporting is limited to reporting the number of leaks + outstanding when the PGPMemoryMgr is disposed. + + + *** Debugging *** + + For debugging purposes, blocks may be larger in debug mode to accomodate + various schemes to detect stray pointers, etc. +____________________________________________________________________________*/ + + +#if PRAGMA_ALIGN_SUPPORTED +#pragma options align=mac68k +#endif + +enum +{ + kPGPMemoryMgrFlags_None = 0, + kPGPMemoryMgrFlags_Clear = 1 +}; + +typedef PGPFlags PGPMemoryMgrFlags; + +typedef struct PGPMemoryMgr PGPMemoryMgr; +typedef PGPMemoryMgr * PGPMemoryMgrRef; + +#define kInvalidPGPMemoryMgrRef ((PGPMemoryMgrRef) NULL) +#define PGPMemoryMgrRefIsValid(ref) ((ref) != kInvalidPGPMemoryMgrRef) + +typedef void *(*PGPMemoryMgrAllocationProc)( PGPMemoryMgrRef mgr, + PGPUserValue userValue, + PGPSize requestSize, PGPMemoryMgrFlags flags ); + +/* realloc not be implemented using PGPNewData() */ +typedef PGPError (*PGPMemoryMgrReallocationProc)( PGPMemoryMgrRef mgr, + PGPUserValue userValue, + void **allocation, PGPSize newAllocationSize, + PGPMemoryMgrFlags flags, PGPSize existingSize ); + +typedef PGPError (*PGPMemoryMgrDeallocationProc)( PGPMemoryMgrRef mgr, + PGPUserValue userValue, + void *allocation, PGPSize allocationSize ); + + + +typedef void *(*PGPMemoryMgrSecureAllocationProc)( PGPMemoryMgrRef mgr, + PGPUserValue userValue, + PGPSize requestSize, PGPMemoryMgrFlags flags, + PGPBoolean *isNonPageable ); + + +/* deallocation proc need not clear the memory upon deallocation since + PGPFreeData() does it automatically */ +typedef PGPError (*PGPMemoryMgrSecureDeallocationProc)( PGPMemoryMgrRef mgr, + PGPUserValue userValue, + void *allocation, PGPSize allocationSize, + PGPBoolean wasLocked ); + + +typedef struct PGPNewMemoryMgrStruct +{ + /* sizeofStruct must be inited to sizeof( PGPNewMemoryMgrStruct ) */ + PGPUInt32 sizeofStruct; + PGPFlags reservedFlags; + + PGPMemoryMgrAllocationProc allocProc; + PGPMemoryMgrReallocationProc reallocProc; + PGPMemoryMgrDeallocationProc deallocProc; + + PGPMemoryMgrSecureAllocationProc secureAllocProc; + void * reserved; /* MUST be zeroed */ + PGPMemoryMgrSecureDeallocationProc secureDeallocProc; + + PGPUserValue customValue; + void * pad[ 8 ]; /* MUST be zeroed */ +} PGPNewMemoryMgrStruct; + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + + +/*____________________________________________________________________________ + Memory Mgr routines +____________________________________________________________________________*/ +PGPBoolean PGPMemoryMgrIsValid( PGPMemoryMgrRef mgr ); +#define PGPValidateMemoryMgr( mgr ) \ + PGPValidateParam( PGPMemoryMgrIsValid( mgr ) ) + +PGPError PGPNewMemoryMgr( PGPFlags reserved, + PGPMemoryMgrRef *newMemoryMgr ); + +PGPError PGPNewMemoryMgrCustom( PGPNewMemoryMgrStruct const * custom, + PGPMemoryMgrRef *newMemoryMgr ); + +PGPError PGPFreeMemoryMgr( PGPMemoryMgrRef mgr ); + +PGPError PGPGetMemoryMgrCustomValue( PGPMemoryMgrRef mgr, + PGPUserValue *customValue ); +PGPError PGPSetMemoryMgrCustomValue( PGPMemoryMgrRef mgr, + PGPUserValue customValue ); + +/* allocate a block of the specified size */ +void * PGPNewData( PGPMemoryMgrRef mgr, + PGPSize requestSize, PGPMemoryMgrFlags flags ); + +/* allocate a block of the specified size in non-pageable memory */ +/* *isSecure is TRUE if the block definitely can't be paged */ +void * PGPNewSecureData( PGPMemoryMgrRef mgr, + PGPSize requestSize, PGPMemoryMgrFlags flags ); + +/* properly reallocs secure or non-secure blocks */ +/* WARNING: the block may move, even if its size is being reduced */ +PGPError PGPReallocData( PGPMemoryMgrRef mgr, + void **allocation, PGPSize newAllocationSize, + PGPMemoryMgrFlags flags ); + +/* properly frees secure or non-secure blocks */ +PGPError PGPFreeData( void *allocation ); + + +/*____________________________________________________________________________ + Block Info: + kPGPMemoryMgrBlockInfo_Valid it's a valid block + kPGPMemoryMgrBlockInfo_Secure block is a secure allocation + kPGPMemoryMgrBlockInfo_NonPageable block cannot be paged by VM + + Secure blocks are always wiped before being disposed, + but may or may not be pageable, depending on the OS facilities. Some + OSs may not provide the ability to make blocks non-pageable. + + You should check these flags if the information matters to you. +____________________________________________________________________________*/ +#define kPGPMemoryMgrBlockInfo_Valid ( ((PGPFlags)1) << 0 ) +#define kPGPMemoryMgrBlockInfo_Secure ( ((PGPFlags)1) << 1 ) +#define kPGPMemoryMgrBlockInfo_NonPageable ( ((PGPFlags)1) << 2 ) +PGPFlags PGPGetMemoryMgrDataInfo( void *allocation ); + + +/*____________________________________________________________________________ + Default memory manager routines: +____________________________________________________________________________*/ + +PGPMemoryMgrRef PGPGetDefaultMemoryMgr(void); +PGPError PGPSetDefaultMemoryMgr(PGPMemoryMgrRef memoryMgr); + + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + + + +#if PRAGMA_ALIGN_SUPPORTED +#pragma options align=reset +#endif + + +#endif /* ] Included_pgpMemoryMgr_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpOptionList.h b/cryptopp/PGPw/sdk6/include/pgpOptionList.h new file mode 100644 index 0000000..7ccbc8e --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpOptionList.h @@ -0,0 +1,452 @@ +/*____________________________________________________________________________ + pgpOptionList.h + + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + This file contains the types and prototypes for functions which manipulate + PGPOptionList data structures. + + $Id: pgpOptionList.h,v 1.35 1999/05/07 23:47:46 hal Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpOptionList_h /* [ */ +#define Included_pgpOptionList_h + +#include + +#include "pgpPubTypes.h" + +#if PGP_MACINTOSH +#include +#endif + +/* Standard event callback declaration */ +struct PGPEvent; +typedef PGPError (*PGPEventHandlerProcPtr)(PGPContextRef context, + struct PGPEvent *event, PGPUserValue userValue); + +/* Export formats for exporting functions */ +enum PGPExportFormat_ +{ + kPGPExportFormat_Basic = 1, + kPGPExportFormat_Complete = 255, + + kPGPExportFormat_X509Cert = 10000, + + kPGPExportFormat_X509CertReq = 11000, + kPGPExportFormat_NetToolsCAV1_CertReq, + kPGPExportFormat_VerisignV1_CertReq, + kPGPExportFormat_EntrustV1_CertReq, + + /* Deprecated aliases for three above */ +/* kPGPExportFormat_NetToolsCAV1 = 11001, + kPGPExportFormat_VerisignV1, + kPGPExportFormat_EntrustV1, +*/ + kPGPExportFormat_X509GetCertInitial = 11010, + kPGPExportFormat_NetToolsCAV1_GetCertInitial, + kPGPExportFormat_VerisignV1_GetCertInitial, + kPGPExportFormat_EntrustV1_GetCertInitial, + + kPGPExportFormat_X509GetCRL = 11020, + kPGPExportFormat_NetToolsCAV1_GetCRL, + kPGPExportFormat_VerisignV1_GetCRL, + kPGPExportFormat_EntrustV1_GetCRL, + + PGP_ENUM_FORCE( PGPExportFormat_ ) +} ; +PGPENUM_TYPEDEF( PGPExportFormat_, PGPExportFormat ); + +/* Input formats for PGPOInputFormat */ +enum PGPInputFormat_ +{ + kPGPInputFormat_Unknown = 0, + kPGPInputFormat_PGP = 1, + + kPGPInputFormat_X509DataInPKCS7 = 10000, + kPGPInputFormat_NetToolsCAV1_DataInPKCS7, + kPGPInputFormat_VerisignV1_DataInPKCS7, + kPGPInputFormat_EntrustV1_DataInPKCS7, + + /* Deprecated aliases for three above */ +/* kPGPInputFormat_NetToolsCAV1 = 10001, + kPGPInputFormat_VerisignV1, + kPGPInputFormat_EntrustV1, +*/ + kPGPInputFormat_PEMEncodedX509Cert, + kPGPInputFormat_NetToolsCAV1_PEMEncoded, + kPGPInputFormat_VerisignV1_PEMEncoded, + kPGPInputFormat_EntrustV1_PEMEncoded, + + /* Input formats for X.509 private keys */ + kPGPInputFormat_PrivateKeyInfo, + kPGPInputFormat_PKCS12, + + PGP_ENUM_FORCE( PGPInputFormat_ ) +} ; +PGPENUM_TYPEDEF( PGPInputFormat_, PGPInputFormat ); + +/* Output formats for PGPOOutputFormat */ +enum PGPOutputFormat_ +{ + kPGPOutputFormat_Unknown = 0, + kPGPOutputFormat_PGP = 1, + + kPGPOutputFormat_X509CertReqInPKCS7 = 10000, + kPGPOutputFormat_NetToolsCAV1_CertReqInPKCS7, + kPGPOutputFormat_VerisignV1_CertReqInPKCS7, + kPGPOutputFormat_EntrustV1_CertReqInPKCS7, + + /* Deprecated aliases for above three */ +/* kPGPOutputFormat_NetToolsCAV1 = 10001, + kPGPOutputFormat_VerisignV1, + kPGPOutputFormat_EntrustV1, +*/ + kPGPOutputFormat_X509GetCertInitialInPKCS7 = 10010, + kPGPOutputFormat_NetToolsCAV1_GetCertInitialInPKCS7, + kPGPOutputFormat_VerisignV1_GetCertInitialInPKCS7, + kPGPOutputFormat_EntrustV1_GetCertInitialInPKCS7, + + kPGPOutputFormat_X509GetCRLInPKCS7 = 10020, + kPGPOutputFormat_NetToolsCAV1_GetCRLInPKCS7, + kPGPOutputFormat_VerisignV1_GetCRLInPKCS7, + kPGPOutputFormat_EntrustV1_GetCRLInPKCS7, + + PGP_ENUM_FORCE( PGPOutputFormat_ ) +} ; +PGPENUM_TYPEDEF( PGPOutputFormat_, PGPOutputFormat ); + +/* Attribute-Value structure for PGPOAttributeValue */ +enum PGPAVAttribute_ +{ + /* Pointer properties */ + kPGPAVAttributeFirstPointer = 0, + kPGPAVAttribute_CommonName = kPGPAVAttributeFirstPointer, + kPGPAVAttribute_Email, + kPGPAVAttribute_OrganizationName, + kPGPAVAttribute_OrganizationalUnitName, + kPGPAVAttribute_SurName, + kPGPAVAttribute_SerialNumber, + kPGPAVAttribute_Country, + kPGPAVAttribute_Locality, + kPGPAVAttribute_State, + kPGPAVAttribute_StreetAddress, + kPGPAVAttribute_Title, + kPGPAVAttribute_Description, + kPGPAVAttribute_PostalCode, + kPGPAVAttribute_POBOX, + kPGPAVAttribute_PhysicalDeliveryOfficeName, + kPGPAVAttribute_TelephoneNumber, + kPGPAVAttribute_X121Address, + kPGPAVAttribute_ISDN, + kPGPAVAttribute_DestinationIndicator, + kPGPAVAttribute_Name, + kPGPAVAttribute_GivenName, + kPGPAVAttribute_Initials, + kPGPAVAttribute_HouseIdentifier, + kPGPAVAttribute_DirectoryManagementDomain, + kPGPAVAttribute_DomainComponent, + kPGPAVAttribute_UnstructuredName, + kPGPAVAttribute_UnstructuredAddress, + kPGPAVAttribute_RFC822Name, + kPGPAVAttribute_DNSName, + kPGPAVAttribute_AnotherName, + kPGPAVAttribute_IPAddress, + kPGPAVAttribute_CertificateExtension, + + /* Verisign specific */ + kPGPAVAttribute_Challenge, + kPGPAVAttribute_CertType, + kPGPAVAttribute_MailFirstName, + kPGPAVAttribute_MailMiddleName, + kPGPAVAttribute_MailLastName, + kPGPAVAttribute_EmployeeID, + kPGPAVAttribute_MailStop, + kPGPAVAttribute_AdditionalField4, + kPGPAVAttribute_AdditionalField5, + kPGPAVAttribute_AdditionalField6, + kPGPAVAttribute_Authenticate, + + + /* Boolean properties */ + kPGPAVAttributeFirstBoolean = 1000, + + /* Verisign specific */ + kPGPAVAttribute_EmbedEmail, + + + /* Numeric (PGPUInt32) properties */ + kPGPAVAttributeFirstNumber = 2000, + + PGP_ENUM_FORCE( PGPAVAttribute_ ) +} ; +PGPENUM_TYPEDEF( PGPAVAttribute_, PGPAVAttribute ); + +typedef struct PGPAttributeValue { + PGPAVAttribute attribute; + PGPSize size; + union { + PGPBoolean booleanvalue; + PGPUInt32 longvalue; + void *pointervalue; + } value; + PGPUInt32 unused; +} PGPAttributeValue ; + + + +PGP_BEGIN_C_DECLARATIONS + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +PGPError PGPNewOptionList(PGPContextRef context, + PGPOptionListRef *outList); +PGPError PGPAppendOptionList(PGPOptionListRef optionList, + PGPOptionListRef firstOption, ...); +PGPError PGPBuildOptionList( PGPContextRef context, + PGPOptionListRef *outList, + PGPOptionListRef firstOption, ...); +PGPError PGPCopyOptionList(PGPOptionListRef optionList, + PGPOptionListRef *outList ); +PGPError PGPFreeOptionList(PGPOptionListRef optionList); + +/* +** The following functions are used to create PGPOptionListRef's for +** specifying the various options to several SDK functions. The +** functions can be used as inline parameters in a temporary manner or +** used with PGPBuildOptionList() to create persistent lists. +*/ + +/* +** Special PGPOptionListRef to mark last option passed to those functions +** which take variable lists of PGPOptionListRef's: +*/ + +PGPOptionListRef PGPOLastOption( PGPContextRef context ); + +/* +** Special PGPOptionListRef which is always ignored: +*/ + +PGPOptionListRef PGPONullOption( PGPContextRef context); + +/* Data input (required): */ + +PGPOptionListRef PGPOInputFile( PGPContextRef context, + PGPFileSpecRef fileRef); +PGPOptionListRef PGPOInputBuffer( PGPContextRef context, + void const *buffer, PGPSize bufferSize); +#if PGP_MACINTOSH +PGPOptionListRef PGPOInputFileFSSpec( PGPContextRef context, + const FSSpec *fileSpec); +#endif + +/* Data output (optional, generates event if missing): */ + +PGPOptionListRef PGPOOutputFile( PGPContextRef context, + PGPFileSpecRef fileRef); +PGPOptionListRef PGPOOutputBuffer( PGPContextRef context, + void *buffer, PGPSize bufferSize, + PGPSize *outputDataLength); +#if PGP_MACINTOSH +PGPOptionListRef PGPOOutputFileFSSpec( PGPContextRef context, + const FSSpec *fileSpec); +#endif + +/* '*buffer' must be disposed of via PGPFreeData() */ +/* maximum memory usage will be no more than maximumBufferSize */ +PGPOptionListRef PGPOAllocatedOutputBuffer(PGPContextRef context, + void **buffer, + PGPSize maximumBufferSize, + PGPSize *actualBufferSize); +PGPOptionListRef PGPOAppendOutput( PGPContextRef context, + PGPBoolean appendOutput ); +PGPOptionListRef PGPODiscardOutput( PGPContextRef context, + PGPBoolean discardOutput ); + +/* Encrypting and signing */ + +PGPOptionListRef PGPOEncryptToKey( PGPContextRef context, + PGPKeyRef keyRef); +PGPOptionListRef PGPOEncryptToKeySet( PGPContextRef context, + PGPKeySetRef keySetRef); +PGPOptionListRef PGPOEncryptToUserID( PGPContextRef context, + PGPUserIDRef userIDRef); +PGPOptionListRef PGPOSignWithKey( PGPContextRef context, + PGPKeyRef keyRef, + PGPOptionListRef firstOption, ...); +PGPOptionListRef PGPOConventionalEncrypt( PGPContextRef context, + PGPOptionListRef firstOption, + ...); + +PGPOptionListRef PGPOPassphraseBuffer( PGPContextRef context, + const void *passphrase, PGPSize passphraseLength); +PGPOptionListRef PGPOPassphrase( PGPContextRef context, + const char *passphrase); +PGPOptionListRef PGPOPasskeyBuffer( PGPContextRef context, + const void *passkey, PGPSize passkeyLength); +PGPOptionListRef PGPOSessionKey( PGPContextRef context, + const void *sessionKey, PGPSize sessionKeyLength); +PGPOptionListRef PGPOAskUserForEntropy( PGPContextRef context, + PGPBoolean askUserForEntropy ); +PGPOptionListRef PGPORawPGPInput( PGPContextRef context, + PGPBoolean rawPGPInput ); +PGPOptionListRef PGPOCompression( PGPContextRef context, + PGPBoolean compression ); + +PGPOptionListRef PGPOLocalEncoding( PGPContextRef context, + PGPLocalEncodingFlags localEncode); +PGPOptionListRef PGPOOutputLineEndType(PGPContextRef context, + PGPLineEndType lineEnd); +PGPOptionListRef PGPOPGPMIMEEncoding(PGPContextRef context, + PGPBoolean mimeEncoding, PGPSize *mimeBodyOffset, + char mimeSeparator[ kPGPMimeSeparatorSize ]); +PGPOptionListRef PGPOOmitMIMEVersion( PGPContextRef context, + PGPBoolean omitVersion); +PGPOptionListRef PGPOX509Encoding( PGPContextRef context, + PGPBoolean x509Encoding); + +PGPOptionListRef PGPODetachedSig( PGPContextRef context, + PGPOptionListRef firstOption, + ...); + +PGPOptionListRef PGPOCipherAlgorithm( PGPContextRef context, + PGPCipherAlgorithm algorithm); +PGPOptionListRef PGPOHashAlgorithm( PGPContextRef context, + PGPHashAlgorithm algorithm); + +PGPOptionListRef PGPOFailBelowValidity( PGPContextRef context, + PGPValidity minValidity); +PGPOptionListRef PGPOWarnBelowValidity( PGPContextRef context, + PGPValidity minValidity); + + +PGPOptionListRef PGPOEventHandler( PGPContextRef context, + PGPEventHandlerProcPtr eventHandler, + PGPUserValue eventHandlerData); +PGPOptionListRef PGPOSendNullEvents( PGPContextRef context, + PGPTimeInterval approxInterval); + +PGPOptionListRef PGPOArmorOutput( PGPContextRef context, + PGPBoolean armorOutput ); +PGPOptionListRef PGPODataIsASCII( PGPContextRef context, + PGPBoolean dataIsASCII ); +PGPOptionListRef PGPOClearSign( PGPContextRef context, + PGPBoolean clearSign ); +PGPOptionListRef PGPOForYourEyesOnly( PGPContextRef context, + PGPBoolean forYourEyesOnly ); +PGPOptionListRef PGPOKeySetRef( PGPContextRef context, + PGPKeySetRef keysetRef); + +PGPOptionListRef PGPOExportKeySet( PGPContextRef context, + PGPKeySetRef keysetRef); +PGPOptionListRef PGPOExportKey( PGPContextRef context, + PGPKeyRef keyRef); +PGPOptionListRef PGPOExportUserID( PGPContextRef context, + PGPUserIDRef useridRef); +PGPOptionListRef PGPOExportSig( PGPContextRef context, + PGPSigRef sigRef); + +PGPOptionListRef PGPOImportKeysTo( PGPContextRef context, + PGPKeySetRef keysetRef); +PGPOptionListRef PGPOSendEventIfKeyFound( PGPContextRef context, + PGPBoolean sendEventIfKeyFound ); +PGPOptionListRef PGPOPassThroughIfUnrecognized( PGPContextRef context, + PGPBoolean passThroughIfUnrecognized ); +PGPOptionListRef PGPOPassThroughClearSigned( PGPContextRef context, + PGPBoolean passThroughClearSigned ); +PGPOptionListRef PGPOPassThroughKeys( PGPContextRef context, + PGPBoolean passThroughKeys ); +PGPOptionListRef PGPORecursivelyDecode( PGPContextRef context, + PGPBoolean recurse ); + +PGPOptionListRef PGPOKeyGenParams( PGPContextRef context, + PGPPublicKeyAlgorithm pubKeyAlg, + PGPUInt32 bits); + +PGPOptionListRef PGPOKeyGenName( PGPContextRef context, + const void *name, PGPSize nameLength); + +PGPOptionListRef PGPOCreationDate( PGPContextRef context, + PGPTime creationDate); +PGPOptionListRef PGPOExpiration( PGPContextRef context, + PGPUInt32 expirationDays); + +PGPOptionListRef PGPOAdditionalRecipientRequestKeySet( + PGPContextRef context, + PGPKeySetRef arKeySetRef, PGPByte arkClass); + +PGPOptionListRef PGPORevocationKeySet(PGPContextRef context, + PGPKeySetRef raKeySetRef); + +PGPOptionListRef PGPOKeyGenMasterKey( PGPContextRef context, + PGPKeyRef masterKeyRef); + +PGPOptionListRef PGPOPreferredAlgorithms( + PGPContextRef context, + PGPCipherAlgorithm const *prefAlg, + PGPUInt32 numAlgs); + +PGPOptionListRef PGPOKeyGenFast( PGPContextRef context, + PGPBoolean fastGen); + +PGPOptionListRef PGPOKeyGenUseExistingEntropy( PGPContextRef context, + PGPBoolean useExistingEntropy); + +PGPOptionListRef PGPOCommentString( PGPContextRef context, + char const *comment); + +PGPOptionListRef PGPOVersionString( PGPContextRef context, + char const *version); + +PGPOptionListRef PGPOFileNameString( PGPContextRef context, + char const *fileName); + +PGPOptionListRef PGPOSigRegularExpression(PGPContextRef context, + char const *regularExpression); + +PGPOptionListRef PGPOExportPrivateKeys( PGPContextRef context, + PGPBoolean exportKeys); + +PGPOptionListRef PGPOExportPrivateSubkeys( PGPContextRef context, + PGPBoolean exportSubkeys); + +PGPOptionListRef PGPOExportFormat(PGPContextRef context, + PGPExportFormat exportFormat); + +PGPOptionListRef PGPOExportable( PGPContextRef context, + PGPBoolean exportable); + +PGPOptionListRef PGPOSigTrust( PGPContextRef context, + PGPUInt32 trustLevel, + PGPUInt32 trustValue); + +PGPOptionListRef PGPOInputFormat( PGPContextRef context, + PGPInputFormat inputFormat ); + +PGPOptionListRef PGPOOutputFormat( PGPContextRef context, + PGPOutputFormat outputFormat ); + +PGPOptionListRef PGPOAttributeValue( PGPContextRef context, + PGPAttributeValue *attributeValue, + PGPUInt32 attributeValueCount); + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpOptionList_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpPFLConfig.h b/cryptopp/PGPw/sdk6/include/pgpPFLConfig.h new file mode 100644 index 0000000..a5d7e67 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpPFLConfig.h @@ -0,0 +1,51 @@ +/*____________________________________________________________________________ + pgpPFLConfig.h (Win32 version) + + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + This file contains the Win32 version of the configuration file + normally generated by the automatic configure script on Unix. + + $Id: pgpPFLConfig.h,v 1.8 1999/03/10 02:53:58 heller Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpPFLConfig_h /* [ */ +#define Included_pgpPFLConfig_h + +#define HAVE_STDARG_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_UNISTD_H 0 +#define HAVE_USHORT 0 +#define HAVE_UINT 0 +#define HAVE_ULONG 0 +#define NO_LIMITS_H 0 +#define NO_POPEN 1 + +#if defined( __MWERKS__ ) + + #define PGP_HAVE64 0 + + +#elif defined( _MSC_VER ) + #define PGP_HAVE64 1 + typedef __int64 PGPInt64; + typedef unsigned __int64 PGPUInt64; + + + +#endif + + + + +#endif /* ] Included_pgpPFLConfig_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpPFLErrors.h b/cryptopp/PGPw/sdk6/include/pgpPFLErrors.h new file mode 100644 index 0000000..ca35c79 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpPFLErrors.h @@ -0,0 +1,97 @@ +/*____________________________________________________________________________ + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + Error codes. + + $Id: pgpPFLErrors.h,v 1.24.6.1 1999/06/13 20:27:13 heller Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpPFLErrors_h /* [ */ +#define Included_pgpPFLErrors_h + +#include "pgpBase.h" + +#define kPGPPFLErrorBase -12000 +#define kPGPPFLErrorRange 500 + +enum +{ + /* + NOTE: error numbers must not be changed as compile clients depend on them. + */ + + kPGPError_NoErr = 0, + + kPGPError_BadParams = -12000, + kPGPError_OutOfMemory = -11999, + kPGPError_BufferTooSmall = -11998, + + kPGPError_FileNotFound = -11997, + kPGPError_CantOpenFile = -11996, + kPGPError_FilePermissions = -11995, + kPGPError_FileLocked = -11994, + /* Was kPGPError_DiskFull = -11993, */ + kPGPError_IllegalFileOp = -11992, + kPGPError_FileOpFailed = -11991, + kPGPError_ReadFailed = -11990, + kPGPError_WriteFailed = -11989, + kPGPError_EOF = -11988, + + kPGPError_UserAbort = -11987, + kPGPError_UnknownRequest = -11986, + kPGPError_LazyProgrammer = -11985, + kPGPError_ItemNotFound = -11984, + kPGPError_ItemAlreadyExists = -11983, + kPGPError_AssertFailed = -11982, + kPGPError_BadMemAddress = -11981, + kPGPError_UnknownError = -11980, + + kPGPError_PrefNotFound = -11979, + kPGPError_EndOfIteration = -11978, + kPGPError_ImproperInitialization = -11977, + kPGPError_CorruptData = -11976, + kPGPError_FeatureNotAvailable = -11975, + + kPGPError_DiskFull = -11960, + kPGPError_DiskLocked = -11959, + + + kPGPError_LastPFLError = kPGPPFLErrorBase + kPGPPFLErrorRange - 1 +}; + +#define IsPGPError( err ) ( (err) != kPGPError_NoErr ) +#define IsntPGPError( err ) ( (err) == kPGPError_NoErr ) + + + +#define PGPValidateParam( expr ) \ + if ( ! (expr ) ) \ + {\ + return( kPGPError_BadParams );\ + } + +#define PGPValidatePtr( ptr ) \ + PGPValidateParam( (ptr) != NULL ) + + +PGP_BEGIN_C_DECLARATIONS + + +PGPError PGPGetPFLErrorString( PGPError theError, + PGPSize bufferSize, char * theString ); + + +PGP_END_C_DECLARATIONS + + +#endif /* ] Included_pgpPFLErrors_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpPubTypes.h b/cryptopp/PGPw/sdk6/include/pgpPubTypes.h new file mode 100644 index 0000000..a420bfb --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpPubTypes.h @@ -0,0 +1,276 @@ +/*____________________________________________________________________________ + pgpPubTypes.h + + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + Opaque types for various modules go in this file. + + $Id: pgpPubTypes.h,v 1.49.6.1 1999/06/11 06:14:33 heller Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpPubTypes_h /* [ */ +#define Included_pgpPubTypes_h + + +#include "pgpConfig.h" +#include "pgpBase.h" + + +/*____________________________________________________________________________ + General data types used by PGPsdk +____________________________________________________________________________*/ +typedef struct PGPContext * PGPContextRef; +typedef struct PGPFileSpec * PGPFileSpecRef; +typedef struct PGPOptionList * PGPOptionListRef; + +/*____________________________________________________________________________ + Data types used by the key manipulation functions +____________________________________________________________________________*/ + +typedef struct PGPKeyDB * PGPKeyDBRef; +typedef struct PGPKey * PGPKeyRef; +typedef struct PGPSubKey * PGPSubKeyRef; +typedef struct PGPUserID * PGPUserIDRef; +typedef struct PGPSig * PGPSigRef; +typedef struct PGPKeySet * PGPKeySetRef; +typedef struct PGPKeyList * PGPKeyListRef; +typedef struct PGPKeyIter * PGPKeyIterRef; +typedef struct PGPFilter * PGPFilterRef; + +typedef struct PGPKeyID +{ + /* do not attempt to interpret these bytes; they *will* change */ + PGPByte opaqueBytes[ 34 ]; +} PGPKeyID; + + +/*____________________________________________________________________________ + Data types used by symmetric ciphers, cipher modes, hashing +____________________________________________________________________________*/ +typedef struct PGPHashContext * PGPHashContextRef; +typedef struct PGPHMACContext * PGPHMACContextRef; +typedef struct PGPPublicKeyContext * PGPPublicKeyContextRef; +typedef struct PGPPrivateKeyContext * PGPPrivateKeyContextRef; +typedef struct PGPCBCContext * PGPCBCContextRef; +typedef struct PGPCFBContext * PGPCFBContextRef; +typedef struct PGPSymmetricCipherContext * PGPSymmetricCipherContextRef; + +/*____________________________________________________________________________ + Data types used by keyserver code +____________________________________________________________________________*/ + +typedef struct PGPKeyServer * PGPKeyServerRef; + +/*____________________________________________________________________________ + Invalid values for each of the "ref" data types. Use these for assignment + and initialization only. Use the PGPXXXRefIsValid macros (below) to test + for valid/invalid values. +____________________________________________________________________________*/ + +#define kInvalidPGPContextRef ((PGPContextRef) NULL) +#define kInvalidPGPFileSpecRef ((PGPFileSpecRef) NULL) +#define kInvalidPGPOptionListRef ((PGPOptionListRef) NULL) + +#define kInvalidPGPKeyDBRef ((PGPKeyDBRef) NULL) +#define kInvalidPGPKeyRef ((PGPKeyRef) NULL) +#define kInvalidPGPSubKeyRef ((PGPSubKeyRef) NULL) +#define kInvalidPGPUserIDRef ((PGPUserIDRef) NULL) +#define kInvalidPGPSigRef ((PGPSigRef) NULL) +#define kInvalidPGPKeySetRef ((PGPKeySetRef) NULL) +#define kInvalidPGPKeyListRef ((PGPKeyListRef) NULL) +#define kInvalidPGPKeyIterRef ((PGPKeyIterRef) NULL) +#define kInvalidPGPFilterRef ((PGPFilterRef) NULL) +#define kInvalidPGPKeyServerRef ((PGPKeyServerRef) NULL) + + +#define kInvalidPGPHashContextRef \ + ((PGPHashContextRef) NULL) +#define kInvalidPGPHMACContextRef \ + ((PGPHMACContextRef) NULL) +#define kInvalidPGPCFBContextRef \ + ((PGPCFBContextRef) NULL) +#define kInvalidPGPCBCContextRef \ + ((PGPCBCContextRef) NULL) +#define kInvalidPGPSymmetricCipherContextRef \ + ((PGPSymmetricCipherContextRef) NULL) +#define kInvalidPGPPublicKeyContextRef \ + ((PGPPublicKeyContextRef) NULL) +#define kInvalidPGPPrivateKeyContextRef \ + ((PGPPrivateKeyContextRef) NULL) + +/* kPGPInvalidRef is deprecated. Please use a type-specific version */ +#define kPGPInvalidRef NULL + +/*____________________________________________________________________________ + Macros to test for ref validity. Use these in preference to comparing + directly with the kInvalidXXXRef values. +____________________________________________________________________________*/ + +#define PGPContextRefIsValid( ref ) ( (ref) != kInvalidPGPContextRef ) +#define PGPFileSpecRefIsValid( ref ) ( (ref) != kInvalidPGPFileSpecRef ) +#define PGPOptionListRefIsValid( ref ) ( (ref) != kInvalidPGPOptionListRef ) + +#define PGPKeyDBRefIsValid( ref ) ( (ref) != kInvalidPGPKeyDBRef ) +#define PGPKeyRefIsValid( ref ) ( (ref) != kInvalidPGPKeyRef ) +#define PGPSubKeyRefIsValid( ref ) ( (ref) != kInvalidPGPSubKeyRef ) +#define PGPUserIDRefIsValid( ref ) ( (ref) != kInvalidPGPUserIDRef ) +#define PGPSigRefIsValid( ref ) ( (ref) != kInvalidPGPSigRef ) +#define PGPKeySetRefIsValid( ref ) ( (ref) != kInvalidPGPKeySetRef ) +#define PGPKeyListRefIsValid( ref ) ( (ref) != kInvalidPGPKeyListRef ) +#define PGPKeyIterRefIsValid( ref ) ( (ref) != kInvalidPGPKeyIterRef ) +#define PGPFilterRefIsValid( ref ) ( (ref) != kInvalidPGPFilterRef ) +#define PGPKeyServerRefIsValid( ref ) ( (ref) != kInvalidPGPKeyServerRef ) + +#define PGPHashContextRefIsValid( ref ) \ + ( (ref) != kInvalidPGPHashContextRef ) +#define PGPHMACContextRefIsValid( ref ) \ + ( (ref) != kInvalidPGPHMACContextRef ) +#define PGPCFBContextRefIsValid( ref ) \ + ( (ref) != kInvalidPGPCFBContextRef ) +#define PGPCBCContextRefIsValid( ref ) \ + ( (ref) != kInvalidPGPCBCContextRef ) +#define PGPSymmetricCipherContextRefIsValid( ref ) \ + ( (ref) != kInvalidPGPSymmetricCipherContextRef ) +#define PGPPublicKeyContextRefIsValid( ref ) \ + ( (ref) != kInvalidPGPPublicKeyContextRef ) +#define PGPPrivateKeyContextRefIsValid( ref ) \ + ( (ref) != kInvalidPGPPrivateKeyContextRef ) + +/* PGPRefIsValid() is deprecated. Please use a type-specific version */ +#define PGPRefIsValid( ref ) ( (ref) != kPGPInvalidRef ) + +/*____________________________________________________________________________ + Symmetric Ciphers +____________________________________________________________________________*/ + +enum PGPCipherAlgorithm_ +{ + /* do NOT change these values */ + kPGPCipherAlgorithm_None = 0, + kPGPCipherAlgorithm_IDEA = 1, + kPGPCipherAlgorithm_3DES = 2, + kPGPCipherAlgorithm_CAST5 = 3, + + kPGPCipherAlgorithm_First = kPGPCipherAlgorithm_IDEA, + kPGPCipherAlgorithm_Last = kPGPCipherAlgorithm_CAST5, + + PGP_ENUM_FORCE( PGPCipherAlgorithm_ ) +}; +PGPENUM_TYPEDEF( PGPCipherAlgorithm_, PGPCipherAlgorithm ); + +/*____________________________________________________________________________ + Hash algorithms +____________________________________________________________________________*/ + +enum PGPHashAlgorithm_ +{ + /* do NOT change these values */ + kPGPHashAlgorithm_Invalid = 0, + kPGPHashAlgorithm_MD5 = 1, + kPGPHashAlgorithm_SHA = 2, + kPGPHashAlgorithm_RIPEMD160 = 3, + + kPGPHashAlgorithm_First = kPGPHashAlgorithm_MD5, + kPGPHashAlgorithm_Last = kPGPHashAlgorithm_RIPEMD160, + + PGP_ENUM_FORCE( PGPHashAlgorithm_ ) +}; +PGPENUM_TYPEDEF( PGPHashAlgorithm_, PGPHashAlgorithm ); + +/*____________________________________________________________________________ + Public/Private key algorithms +____________________________________________________________________________*/ +enum PGPPublicKeyAlgorithm_ +{ + /* note: do NOT change these values */ + kPGPPublicKeyAlgorithm_Invalid = 0xFFFFFFFF, + kPGPPublicKeyAlgorithm_RSA = 1, + kPGPPublicKeyAlgorithm_RSAEncryptOnly = 2, + kPGPPublicKeyAlgorithm_RSASignOnly = 3, + kPGPPublicKeyAlgorithm_ElGamal = 0x10, /* A.K.A.Diffie-Hellman */ + kPGPPublicKeyAlgorithm_DSA = 0x11, + + kPGPPublicKeyAlgorithm_First = kPGPPublicKeyAlgorithm_RSA, + kPGPPublicKeyAlgorithm_Last = kPGPPublicKeyAlgorithm_DSA, + + PGP_ENUM_FORCE( PGPPublicKeyAlgorithm_ ) +}; +PGPENUM_TYPEDEF( PGPPublicKeyAlgorithm_, PGPPublicKeyAlgorithm ); + +/*____________________________________________________________________________ + Trust values, used to set validity values +____________________________________________________________________________*/ + +#define kPGPKeyTrust_Mask 0x7u +#define kPGPKeyTrust_Undefined 0x0u +#define kPGPKeyTrust_Unknown 0x1u +#define kPGPKeyTrust_Never 0x2u +#define kPGPKeyTrust_Marginal 0x5u +#define kPGPKeyTrust_Complete 0x6u +#define kPGPKeyTrust_Ultimate 0x7u + +#define kPGPNameTrust_Mask 0x3u +#define kPGPNameTrust_Unknown 0x0u +#define kPGPNameTrust_Untrusted 0x1u +#define kPGPNameTrust_Marginal 0x2u +#define kPGPNameTrust_Complete 0x3u + +/*____________________________________________________________________________ + Validity levels, used for thresholds in options +____________________________________________________________________________*/ + +enum PGPValidity_ +{ + kPGPValidity_Unknown = kPGPNameTrust_Unknown, + kPGPValidity_Invalid = kPGPNameTrust_Untrusted, + kPGPValidity_Marginal = kPGPNameTrust_Marginal, + kPGPValidity_Complete = kPGPNameTrust_Complete, + + PGP_ENUM_FORCE( PGPValidity_ ) +} ; +PGPENUM_TYPEDEF( PGPValidity_, PGPValidity ); + +/*____________________________________________________________________________ + Line endings types +____________________________________________________________________________*/ + +enum PGPLineEndType_ +{ + kPGPLineEnd_Default = 0, + kPGPLineEnd_LF = 1, + kPGPLineEnd_CR = 2, + kPGPLineEnd_CRLF = (kPGPLineEnd_LF | kPGPLineEnd_CR), + PGP_ENUM_FORCE( PGPLineEndType_ ) +}; +PGPENUM_TYPEDEF( PGPLineEndType_, PGPLineEndType ); + +/*____________________________________________________________________________ + Local encoding types + + Only one of Force or Auto should be used. The other values are modifiers +____________________________________________________________________________*/ + +#define kPGPLocalEncoding_None 0x0 /* nothing on */ +#define kPGPLocalEncoding_Force 0x01 +#define kPGPLocalEncoding_Auto 0x02 +#define kPGPLocalEncoding_NoMacBinCRCOkay 0x04 + +typedef PGPFlags PGPLocalEncodingFlags; + + +/* max length is 255; the +1 is for the trailing \0 */ +#define kPGPMaxUserIDSize ( (PGPSize)255 + 1 ) + +/* Size of buffer for PGP-MIME separator (null terminated) */ +#define kPGPMimeSeparatorSize 81 + +#endif /* ] Included_pgpPubTypes_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpPublicKey.h b/cryptopp/PGPw/sdk6/include/pgpPublicKey.h new file mode 100644 index 0000000..d780876 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpPublicKey.h @@ -0,0 +1,213 @@ +/*____________________________________________________________________________ + pgpPublicKey.h + + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + $Id: pgpPublicKey.h,v 1.10 1999/03/10 02:54:43 heller Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpPublicKey_h /* [ */ +#define Included_pgpPublicKey_h + +#include "pgpPubTypes.h" +#include "pgpOptionList.h" + + + +/*____________________________________________________________________________ + Encryption/Signature Message Formats +____________________________________________________________________________*/ + +enum PGPPublicKeyMessageFormat_ +{ + kPGPPublicKeyMessageFormat_PGP = 1, + kPGPPublicKeyMessageFormat_PKCS1 = 2, + kPGPPublicKeyMessageFormat_X509 = 3, + kPGPPublicKeyMessageFormat_IKE = 4, + + PGP_ENUM_FORCE( PGPPublicKeyMessageFormat_ ) +}; +PGPENUM_TYPEDEF( PGPPublicKeyMessageFormat_, PGPPublicKeyMessageFormat ); + + + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + + + +/*____________________________________________________________________________ + Public-key operations +____________________________________________________________________________*/ + + + +/*____________________________________________________________________________ + Return a context for public-key operations based on the specified key. + The specified message format is used for all operations with this + context. +____________________________________________________________________________*/ +PGPError PGPNewPublicKeyContext( PGPKeyRef publicKeyRef, + PGPPublicKeyMessageFormat messageFormat, + PGPPublicKeyContextRef *outRef ); + + +/*____________________________________________________________________________ + Dispose of a public-key context. +____________________________________________________________________________*/ +PGPError PGPFreePublicKeyContext( PGPPublicKeyContextRef ref ); + + +/*____________________________________________________________________________ + Determine maximum sizes for inputs and outputs. +____________________________________________________________________________*/ +PGPError PGPGetPublicKeyOperationSizes( PGPPublicKeyContextRef ref, + PGPSize *maxDecryptedBufferSize, + PGPSize *maxEncryptedBufferSize, + PGPSize *maxSignatureSize ); + + +/*____________________________________________________________________________ + Encrypt one block of data, using PKCS-1 padding. Output buffer must + be of size maxEncryptedBufferSize from PGPGetPublicKeyEncryptionSize. + outSize is a return parameter. For some formatting modes the actual + output size may be less than the maximum possible. +____________________________________________________________________________*/ +PGPError PGPPublicKeyEncrypt( PGPPublicKeyContextRef ref, + void const *in, PGPSize inSize, void *out, + PGPSize *outSize ); + + +/*____________________________________________________________________________ + Verify a signature on a message hash. Returns kPGPError_NoErr on + correct verification, else an error code. The message hash is + finalized and freed by this call (and should not have been finalized + prior to the call). +____________________________________________________________________________*/ + +PGPError PGPPublicKeyVerifySignature( PGPPublicKeyContextRef ref, + PGPHashContextRef hashContext, + void const *signature, PGPSize signatureSize ); + + +/*____________________________________________________________________________ + Verify a signature on a low-level buffer. Returns kPGPError_NOErr + correct verification, else an error code. Not valid with + kPGPPublicKeyMessageFormat_PGP contexts. +____________________________________________________________________________*/ + +PGPError PGPPublicKeyVerifyRaw( PGPPublicKeyContextRef ref, + void const *signedData, PGPSize signedDataSize, + void const *signature, PGPSize signatureSize ); + + +/*____________________________________________________________________________ + Private-key operations +____________________________________________________________________________*/ + + + +/*____________________________________________________________________________ + Return a context for private-key operations based on the specified + key (which must have a private part). The specified message + format is used for all operations with this context. Unlocks key + data using passphrase. +____________________________________________________________________________*/ + + +PGPError PGPNewPrivateKeyContext( PGPKeyRef privateKeyRef, + PGPPublicKeyMessageFormat messageFormat, + PGPPrivateKeyContextRef *outRef, + PGPOptionListRef firstOption, ...); + +/*____________________________________________________________________________ + Dispose of a private-key context. All sensitive data is wiped before + being deleted. +____________________________________________________________________________*/ +PGPError PGPFreePrivateKeyContext( PGPPrivateKeyContextRef ref ); + + +/*____________________________________________________________________________ + Determine maximum sizes for inputs and outputs. +____________________________________________________________________________*/ +PGPError PGPGetPrivateKeyOperationSizes( PGPPrivateKeyContextRef ref, + PGPSize *maxDecryptedBufferSize, + PGPSize *maxEncryptedBufferSize, + PGPSize *maxSignatureSize); + + +/*____________________________________________________________________________ + Decrypt one block of data. Output buffer must be of size at least + maxDecryptedBufferSize from PGPGetPrivateKeyDecryptionSize. + outSize is a return parameter. For some formatting modes the actual + output size may be less than the maximum possible. +____________________________________________________________________________*/ +PGPError PGPPrivateKeyDecrypt( PGPPrivateKeyContextRef ref, + void const *in, PGPSize inSize, void *out, + PGPSize *outSize ); + + +/*____________________________________________________________________________ + Sign a message hash. Output signature buffer must be of size at + least maxSignatureSize from PGPGetPrivateKeyDecryptionSize. + signatureSize is a return parameter. For some formatting modes + the actual signature size may be less than the maximum possible. + The message hash is finalized and freed by this call (and should + not have been finalized prior to the call). +____________________________________________________________________________*/ + + +PGPError PGPPrivateKeySign( PGPPrivateKeyContextRef ref, + PGPHashContextRef hashContext, + void *signature, PGPSize *signatureSize ); + +/*____________________________________________________________________________ + Sign a low level signedData buffer. Output signature buffer must be + of size at least maxSignatureSize from PGPGetPrivateKeyDecryptionSize. + signatureSize is a return parameter. Not valid with + kPGPPublicKeyMessageFormat_PGP contexts. +____________________________________________________________________________*/ + +PGPError PGPPrivateKeySignRaw( PGPPrivateKeyContextRef ref, + void const *signedData, PGPSize signedDataSize, + void const *signature, PGPSize *signatureSize ); + + +/*____________________________________________________________________________ + Miscellaneous operations +____________________________________________________________________________*/ + + + +/*____________________________________________________________________________ +Given the size of a prime modulus in bits, this returns an appropriate +size for an exponent in bits, such that the work factor to find a +discrete log modulo the modulus is approximately equal to half the +length of the exponent. This makes the exponent an appropriate size +for a subgroup in a discrete log signature scheme. For encryption +schemes, where decryption attacks can be stealthy and undetected, we +use 3/2 times the returned exponent size. +____________________________________________________________________________*/ + +PGPError PGPDiscreteLogExponentBits( PGPUInt32 modulusBits, + PGPUInt32 *exponentBits ); + + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpPublicKey_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpRandomPool.h b/cryptopp/PGPw/sdk6/include/pgpRandomPool.h new file mode 100644 index 0000000..5a7fabe --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpRandomPool.h @@ -0,0 +1,49 @@ +/*____________________________________________________________________________ + pgpRandomPool.h + + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + $Id: pgpRandomPool.h,v 1.13 1999/04/13 17:43:18 cpeterson Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpRandomPool_h /* [ */ +#define Included_pgpRandomPool_h + +#include "pgpBase.h" + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +PGPUInt32 PGPGlobalRandomPoolAddKeystroke( PGPInt32 event); +PGPUInt32 PGPGlobalRandomPoolMouseMoved(void); +PGPError PGPGlobalRandomPoolAddSystemState(void); + +/* Extra functions for entropy estimation */ +PGPUInt32 PGPGlobalRandomPoolGetEntropy( void ); +PGPUInt32 PGPGlobalRandomPoolGetSize( void ); +PGPUInt32 PGPGlobalRandomPoolGetMinimumEntropy( void ); +PGPBoolean PGPGlobalRandomPoolHasMinimumEntropy( void ); + + +#if PGP_DEPRECATED +PGPUInt32 PGPGlobalRandomPoolAddMouse( PGPUInt32 x, PGPUInt32 y); +#endif + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpRandomPool_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpSDKPrefs.h b/cryptopp/PGPw/sdk6/include/pgpSDKPrefs.h new file mode 100644 index 0000000..2662786 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpSDKPrefs.h @@ -0,0 +1,74 @@ +/*____________________________________________________________________________ + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + $Id: pgpSDKPrefs.h,v 1.7 1999/05/17 07:53:20 heller Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpCDKPrefs_h /* [ */ +#define Included_pgpCDKPrefs_h + +#include "pgpConfig.h" +#include "pgpPubTypes.h" + + +enum PGPsdkPrefSelector_ +{ + kPGPsdkPref_DefaultKeyID = 3, + kPGPsdkPref_PublicKeyring = 5, + kPGPsdkPref_PrivateKeyring = 6, + kPGPsdkPref_RandomSeedFile = 7, + kPGPsdkPref_GroupsFile = 8, + + PGP_ENUM_FORCE( PGPsdkPrefSelector_ ) +}; +PGPENUM_TYPEDEF( PGPsdkPrefSelector_, PGPsdkPrefSelector ); + + + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +/* call this if you want the CDK to use prefs stored in the prefs file */ +PGPError PGPsdkLoadPrefs( PGPContextRef context, + PGPFileSpecRef prefSpec ); +PGPError PGPsdkLoadDefaultPrefs( PGPContextRef context ); + +/* save any changed preferences to disk */ +PGPError PGPsdkSavePrefs( PGPContextRef context ); + + +PGPError PGPsdkPrefSetFileSpec( PGPContextRef context, + PGPsdkPrefSelector selector, PGPFileSpecRef ref ); + +/* caller must deallocate *outRef with PGPFreeFileSpec */ +PGPError PGPsdkPrefGetFileSpec( PGPContextRef context, + PGPsdkPrefSelector selector, PGPFileSpecRef * outRef ); + + +PGPError PGPsdkPrefSetData( PGPContextRef context, + PGPsdkPrefSelector selector, + void const *data, PGPSize size ); + +/* caller must deallocate *dataOut with PGPFreeData */ +PGPError PGPsdkPrefGetData( PGPContextRef context, + PGPsdkPrefSelector selector, + void **dataOut, PGPSize *sizeOut ); + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpCDKPrefs_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpSockets.h b/cryptopp/PGPw/sdk6/include/pgpSockets.h new file mode 100644 index 0000000..c884cc5 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpSockets.h @@ -0,0 +1,476 @@ +/*____________________________________________________________________________ + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + + + $Id: pgpSockets.h,v 1.27.6.1.6.1 1999/08/04 18:36:04 sluu Exp $ +____________________________________________________________________________*/ + + +#ifndef Included_pgpSockets_h /* [ */ +#define Included_pgpSockets_h + +#include + +#include "pgpOptionList.h" +#include "pgpTLS.h" +#include "pgpErrors.h" + +#if PGP_UNIX +# include +# include +#if PGP_UNIX_LINUX +# include /* Needed for unknown reason */ +# include /* Need FIONREAD */ +#elif PGP_UNIX_SOLARIS +# include +#elif PGP_UNIX_AIX +# include +# include +#endif /* ! PGP_UNIX_LINUX */ +# include +# include +#endif + +#if PGP_WIN32 +# include +#endif + +PGP_BEGIN_C_DECLARATIONS + +#if PRAGMA_IMPORT_SUPPORTED +# pragma import on +#endif + +typedef struct PGPSocket * PGPSocketRef; + +/* + * Unix and Windows share the same Berkley socket interface. This isn't + * the most efficient Windows implmentation of TCP/IP, but it is + * compatable with UNIX berkley sockets, making cross-platform possible. + * + * Trying to write cross-platform win32 TCP/IP code using all the fancy + * dancy Win32 network functions would be nearly impossible IMHO + * + * The Mac doesn't have the berkley stuff, so we roll our own for all + * of the structures. + * + * Start with Unix and Win32 + */ +#if PGP_UNIX || PGP_WIN32 + +# define kInvalidPGPSocketRef ((PGPSocketRef) (~0)) + + typedef struct hostent PGPHostEntry; + typedef struct protoent PGPProtocolEntry; + typedef struct servent PGPServiceEntry; + typedef struct sockaddr_in PGPSocketAddressInternet; + typedef struct sockaddr PGPSocketAddress; + typedef struct in_addr PGPInternetAddress; + typedef fd_set PGPSocketSet; + typedef struct timeval PGPSocketsTimeValue; + +# define PGPSOCKETSET_CLEAR(socketRef, set) FD_CLR((int) (socketRef), (set)) +# define PGPSOCKETSET_SET(socketRef, set) FD_SET((int) (socketRef), (set)) +# define PGPSOCKETSET_ZERO(set) FD_ZERO((set)) +# define PGPSOCKETSET_ISSET(socketRef, set) FD_ISSET((int) (socketRef), (set)) + + /* Address families */ + enum { + kPGPAddressFamilyUnspecified = AF_UNSPEC, + kPGPAddressFamilyInternet = AF_INET + }; + + /* Protocol families */ + enum { + kPGPProtocolFamilyInternet = PF_INET + }; + + /* Types */ + enum { + kPGPSocketTypeStream = SOCK_STREAM, + kPGPSocketTypeDatagram = SOCK_DGRAM + }; + + /* Commands for PGPIOControlSocket */ + enum { + kPGPSocketCommandGetUnreadData = FIONREAD + }; + + /* Levels for PGPGetSocketOptions and PGPSetSocketOptions */ + enum { + kPGPSocketOptionLevelSocket = SOL_SOCKET + }; + + /* Options for PGPGetSocketOptions and PGPSetSocketOptions */ +/* On Linux (2.0.24), include has SOL_SOCKET and SO_TYPE, */ +/* but unclear as to what would correspond to SO_ACCEPTCONN, if any. */ +#if PGP_UNIX_LINUX +/* #ifndef SO_ACCEPTCONN */ +#define SO_ACCEPTCONN 0 +/* #endif */ /* SO_ACCEPTCONN */ +#endif /* PGP_UNIX_LINUX */ + enum { + kPGPSocketOptionAcceptingConnections = SO_ACCEPTCONN, + kPGPSocketOptionType = SO_TYPE + }; + + /* Protocols */ + enum { + kPGPTCPProtocol = IPPROTO_TCP, + kPGPUDPProtocol = IPPROTO_UDP + }; + + /* Send flags */ + enum { + kPGPSendFlagNone = 0 + }; + + /* Receive flags */ + enum { + kPGPReceiveFlagNone = 0 + }; + + /* Internet Addresses */ + enum { + kPGPInternetAddressAny = INADDR_ANY + }; + +#endif /* PGP_UNIX || PGP_WIN32 */ + +/* + * Onto the Mac, where we need to create our own versions of the various + * structures. + */ +#if PGP_MACINTOSH + +# define kInvalidPGPSocketRef ((PGPSocketRef) NULL) + + typedef struct PGPInternetAddress { + union { + struct { + PGPByte s_b1; + PGPByte s_b2; + PGPByte s_b3; + PGPByte s_b4; + } S_un_b; + struct { + PGPUInt16 s_w1; + PGPUInt16 s_w2; + } S_un_w; + PGPUInt32 S_addr; + } S_un; +# define s_addr S_un.S_addr + } PGPInternetAddress; + + typedef struct PGPSocketAddressInternet { + PGPInt16 sin_family; + PGPUInt16 sin_port; + PGPInternetAddress sin_addr; + PGPByte sin_zero[8]; + } PGPSocketAddressInternet; + + typedef struct PGPSocketAddress { + PGPUInt16 sa_family; + PGPByte sa_data[14]; + } PGPSocketAddress; + + typedef struct PGPHostEntry { + char * h_name; + char ** unused; + PGPInt16 h_addrtype; + PGPInt16 h_length; + char ** h_addr_list; +# define h_addr h_addr_list[0] + } PGPHostEntry; + + typedef struct PGPProtocolEntry { + char * p_name; + char ** p_aliases; + PGPInt16 p_proto; + } PGPProtocolEntry; + + typedef struct PGPServiceEntry { + char * s_name; + char ** s_aliases; + PGPUInt16 s_port; + char * s_proto; + } PGPServiceEntry; + + /* Select types and defines */ +# ifndef PGPSOCKETSET_SETSIZE +# define PGPSOCKETSET_SETSIZE 64 +# endif + + typedef struct PGPSocketSet { + PGPUInt16 fd_count; + PGPSocketRef fd_array[PGPSOCKETSET_SETSIZE]; + } PGPSocketSet; + +# define PGPSOCKETSET_CLEAR(socketRef, set) do { \ + PGPUInt16 __i; \ + for (__i = 0; __i < ((PGPSocketSet * (set))->fd_count; __i++) { \ + if (((PGPSocketSet *) (set))->fd_array[__i] == socketRef) { \ + while (__i < (((PGPSocketSet *) (set))->fd_count - 1)) { \ + ((PGPSocketSet *) (set))->fd_array[__i] = \ + ((PGPSocketSet *) (set))->fd_array[__i + 1]; \ + __i++; \ + } \ + ((PGPSocketSet *) (set))->fd_count--; \ + break; \ + } \ + } \ + } while (0) + +# define PGPSOCKETSET_SET(socketRef, set) do { \ + if (((PGPSocketSet *) (set))->fd_count < PGPSOCKETSET_SETSIZE) { \ + ((PGPSocketSet *) (set))->fd_array[((PGPSocketSet *) \ + (set))->fd_count++] = (socketRef); \ + } \ + } while (0) + +# define PGPSOCKETSET_ZERO(set) (((PGPSocketSet *) (set))->fd_count = 0) + + PGPInt32 __PGPSocketsIsSet(PGPSocketRef, PGPSocketSet *); + +# define PGPSOCKETSET_ISSET(socketRef, set) __PGPSocketsIsSet( \ + (socketRef),(set)) + + typedef struct PGPSocketsTimeValue { + PGPInt32 tv_sec; /* seconds */ + PGPInt32 tv_usec; /* and microseconds */ + } PGPSocketsTimeValue; + + /* Address families */ + enum { + kPGPAddressFamilyUnspecified = 0, + kPGPAddressFamilyInternet = 2 + }; + + /* Protocol families */ + enum { + kPGPProtocolFamilyInternet = kPGPAddressFamilyInternet + }; + + /* Types */ + enum { + kPGPSocketTypeStream = 1, + kPGPSocketTypeDatagram = 2 + }; + + /* Commands for PGPIOControlSocket */ + enum { + kPGPSocketCommandGetUnreadData = (0x40000000 + | (((long) sizeof(PGPUInt32) & 0x7F) << 16) | ('f' << 8) | 127) + }; + + /* Levels for PGPGetSocketOptions and PGPSetSocketOptions */ + enum { + kPGPSocketOptionLevelSocket = 0xFFFFFFFF + }; + + /* Options for PGPGetSocketOptions and PGPSetSocketOptions */ + enum { + kPGPSocketOptionAcceptingConnections = 0x00000002, + kPGPSocketOptionType = 0x00001008 + }; + + /* Protocols */ + enum { + kPGPTCPProtocol = 6, + kPGPUDPProtocol = 17 + }; + + /* Send flags */ + enum { + kPGPSendFlagNone = 0 + }; + + /* Receive flags */ + enum { + kPGPReceiveFlagNone = 0 + }; + + /* Internet Addresses */ + enum { + kPGPInternetAddressAny = 0x00000000 + }; + +#endif /* PGP_MACINTOSH */ + +/* + * Some global things for all platforms + */ + +#define PGPSocketRefIsValid(ref) ((ref) != kInvalidPGPSocketRef) + +typedef struct PGPSocketsThreadStorage * PGPSocketsThreadStorageRef; +# define kInvalidPGPSocketsThreadStorageRef \ + ((PGPSocketsThreadStorageRef) NULL) +#define PGPSocketsThreadStorageRefIsValid(ref) \ + ((ref) != kInvalidPGPSocketsThreadStorageRef) + +/* Errors */ +#define kPGPSockets_Error -1 + +/* Net byte ordering macros (PGP_WORDSBIGENDIAN defined by configure) */ +#if PGP_WORDSBIGENDIAN +# define PGPHostToNetLong(x) (x) +# define PGPHostToNetShort(x) (x) +# define PGPNetToHostLong(x) (x) +# define PGPNetToHostShort(x) (x) +#else + PGPInt32 PGPHostToNetLong(PGPInt32 x); + PGPInt16 PGPHostToNetShort(PGPInt16 x); + PGPInt32 PGPNetToHostLong(PGPInt32 x); + PGPInt16 PGPNetToHostShort(PGPInt16 x); +#endif /* PGP_WORDSBIGENDIAN */ + +/* + * Shared function interface (except for idle handler code) + */ + +/* + * Use the idle event handler to receive periodic idle events during + * network calls. Usually this is used only in non-preemptive multi-tasking + * OSes to allow yielding in threads. Pre-emptive multi-tasking systems + * should probably not use the call as it interrupts the efficient wait state + * of threads waiting on network calls. + * + * Idle event handlers need to be added on a per thread basis. + * + * Returning an error from the idle event handler will cause the socket + * that is blocking to close. + * + */ +PGPError PGPSetSocketsIdleEventHandler( + PGPEventHandlerProcPtr inCallback, + PGPUserValue inUserData); + +PGPError PGPGetSocketsIdleEventHandler( + PGPEventHandlerProcPtr * outCallback, + PGPUserValue * outUserData); + +/* Static storage creation */ +PGPError PGPSocketsCreateThreadStorage( + PGPSocketsThreadStorageRef * outPreviousStorage); +PGPError PGPSocketsDisposeThreadStorage( + PGPSocketsThreadStorageRef inPreviousStorage); + +/* Stack based class for saving and restoring thread storage */ +#ifdef __cplusplus /* [ */ +class StPGPPreserveSocketsStorage { +public: + StPGPPreserveSocketsStorage() : mStorage(NULL) + { PGPSocketsCreateThreadStorage(&mStorage); } + ~StPGPPreserveSocketsStorage() + { PGPSocketsDisposeThreadStorage(mStorage); } + +protected: + PGPSocketsThreadStorageRef mStorage; +}; +#endif /* ] __cplusplus */ + + +/* Initialization and termination */ +PGPError PGPSocketsInit(void); +void PGPSocketsCleanup(void); + +/* Socket creation and destruction */ +PGPSocketRef PGPOpenSocket(PGPInt32 inAddressFamily, PGPInt32 inSocketType, + PGPInt32 inSocketProtocol); +PGPInt32 PGPCloseSocket(PGPSocketRef inSocketRef); + +/* Endpoint binding */ +PGPInt32 PGPBindSocket(PGPSocketRef inSocketRef, + const PGPSocketAddress * inAddress, + PGPInt32 inAddressLength); +PGPInt32 PGPConnect(PGPSocketRef inSocketRef, + const PGPSocketAddress * inServerAddress, + PGPInt32 inAddressLength); + +/* Send functions */ +PGPInt32 PGPSend(PGPSocketRef inSocketRef, const void * inBuffer, + PGPInt32 inBufferLength, PGPInt32 inFlags); +PGPInt32 PGPWrite(PGPSocketRef inSocketRef, const void * inBuffer, + PGPInt32 inBufferLength); +PGPInt32 PGPSendTo(PGPSocketRef inSocketRef, const void * inBuffer, + PGPInt32 inBufferLength, PGPInt32 inFlags, + PGPSocketAddress * inAddress, + PGPInt32 inAddressLength); + +/* Receive functions */ +PGPInt32 PGPReceive(PGPSocketRef inSocketRef, void * outBuffer, + PGPInt32 inBufferSize, PGPInt32 inFlags); +PGPInt32 PGPRead(PGPSocketRef inSocketRef, void * outBuffer, + PGPInt32 inBufferSize); +PGPInt32 PGPReceiveFrom(PGPSocketRef inSocketRef, void * outBuffer, + PGPInt32 inBufferSize, PGPInt32 inFlags, + PGPSocketAddress * outAddress, + PGPInt32 * ioAddressLength); + +/* Server functions */ +PGPInt32 PGPListen(PGPSocketRef inSocketRef, PGPInt32 inMaxBacklog); +PGPSocketRef PGPAccept(PGPSocketRef inSocketRef, + PGPSocketAddress * outAddress, + PGPInt32 * ioAddressLength); + +/* Select */ +/* Note that inNumSetCount is not used under Mac and Windows */ +PGPInt32 PGPSelect(PGPInt32 inNumSetCount, + PGPSocketSet * ioReadSet, + PGPSocketSet * ioWriteSet, + PGPSocketSet * ioErrorSet, + const PGPSocketsTimeValue * inTimeout); + +/* DNS and protocol services */ +PGPHostEntry * PGPGetHostByName(const char * inName); +PGPHostEntry * PGPGetHostByAddress(const char* inAddress, + PGPInt32 inLength, + PGPInt32 inType); +PGPInt32 PGPGetHostName(char * outName, PGPInt32 inNameLength); +PGPProtocolEntry * PGPGetProtocolByName(const char * inName); +PGPProtocolEntry * PGPGetProtocolByNumber(PGPInt32 inNumber); +PGPServiceEntry * PGPGetServiceByName(const char * inName, + const char * inProtocol); +PGPServiceEntry * PGPGetServiceByPort(PGPInt32 inPort, + const char * inProtocol); + +/* Error reporting */ +PGPError PGPGetLastSocketsError(void); + +/* Utilities */ +PGPInt32 PGPGetSocketName(PGPSocketRef inSocketRef, + PGPSocketAddress * outName, + PGPInt32 * ioNameLength); +PGPInt32 PGPGetPeerName(PGPSocketRef inSocketRef, + PGPSocketAddress * outName, + PGPInt32 * ioNameLength); +PGPUInt32 PGPDottedToInternetAddress(const char * inAddress); +char * PGPInternetAddressToDottedString(PGPInternetAddress inAddress); + +/* Control and options */ +PGPInt32 PGPIOControlSocket(PGPSocketRef inSocketRef, + PGPInt32 inCommand, PGPUInt32 * ioParam); +PGPInt32 PGPGetSocketOptions(PGPSocketRef inSocketRef, PGPInt32 inLevel, + PGPInt32 inOptionName, + char * outOptionValue, + PGPInt32 * ioOptionLength); +PGPInt32 PGPSetSocketOptions(PGPSocketRef inSocketRef, PGPInt32 inLevel, + PGPInt32 inOptionName, + const char * inOptionValue, + PGPInt32 inOptionLength); + +/* TLS */ +PGPError PGPSocketsEstablishTLSSession(PGPSocketRef inSocketRef, + PGPtlsSessionRef inTLSSession); + + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif + +PGP_END_C_DECLARATIONS + +#endif /* Included_pgpSockets_h */ diff --git a/cryptopp/PGPw/sdk6/include/pgpSymmetricCipher.h b/cryptopp/PGPw/sdk6/include/pgpSymmetricCipher.h new file mode 100644 index 0000000..b1dec16 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpSymmetricCipher.h @@ -0,0 +1,122 @@ +/*____________________________________________________________________________ + pgpSymmetricCipher.h + + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + public header file for symmetric ciphers + + $Id: pgpSymmetricCipher.h,v 1.22 1999/03/10 02:58:47 heller Exp $ +____________________________________________________________________________*/ +#ifndef Included_pgpSymmetricCipher_h /* [ */ +#define Included_pgpSymmetricCipher_h + +#include "pgpPubTypes.h" +#include "pgpMemoryMgr.h" + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + + + +/*____________________________________________________________________________ + Create a new cipher of the specified algorithm. Cannot be used until + PGPSetSymmetricCipherKey() has been called. + + If the algorithm is not available then kPGPError_AlgorithmNotAvailable is + returned. + + Existing algorithms have only one key size. Values: + kPGPCipherAlgorithm_CAST5 128 / 8 = 16 + kPGPCipherAlgorithm_3DES 192 / 8 = 24 + kPGPCipherAlgorithm_IDEA 128 / 8 = 16 + In the future symmetric ciphers could be added that have different key + sizes for the same algorithm. +____________________________________________________________________________*/ +PGPError PGPNewSymmetricCipherContext( PGPMemoryMgrRef memoryMgr, + PGPCipherAlgorithm algorithm, PGPSize keySizeInBytes, + PGPSymmetricCipherContextRef *outRef ); + + +/*____________________________________________________________________________ + Disposal clears all data in memory before releasing it. +____________________________________________________________________________*/ +PGPError PGPFreeSymmetricCipherContext( PGPSymmetricCipherContextRef ref ); + + +/*____________________________________________________________________________ + Make an exact copy of the cipher, including the key. +____________________________________________________________________________*/ +PGPError PGPCopySymmetricCipherContext( PGPSymmetricCipherContextRef ref, + PGPSymmetricCipherContextRef *outRef ); + + +/*____________________________________________________________________________ + The key must be set before using; a cipher can be repeatedly reset and + reused with different keys to avoid having to create and destroy new + contexts each time (and it's also cryptographically better not to reuse + a key). + + kKey size is implicit based on algorithm. 'key' is *copied*. Caller + may want to destroy the original after passing it in. +____________________________________________________________________________*/ +PGPError PGPInitSymmetricCipher( PGPSymmetricCipherContextRef ref, + const void *key ); + +/*____________________________________________________________________________ + Wipe any sensitive data in the cipher. Cipher remains alive, but + key must be set before any data is encrypted. +____________________________________________________________________________*/ +PGPError PGPWipeSymmetricCipher( PGPSymmetricCipherContextRef ref ); + + +/*____________________________________________________________________________ + "Wash" the symmetric cipher +____________________________________________________________________________*/ +PGPError PGPWashSymmetricCipher( PGPSymmetricCipherContextRef ref, + void const *buf, PGPSize len); + + +/*____________________________________________________________________________ + Encrypt or decrypt one "block" of data. The block size is determined + by the cipher (see PGPGetSymmetricCipherBlockSize()). +____________________________________________________________________________*/ +PGPError PGPSymmetricCipherEncrypt( PGPSymmetricCipherContextRef ref, + const void *in, void *out ); + +PGPError PGPSymmetricCipherDecrypt( PGPSymmetricCipherContextRef ref, + const void *in, void *out ); + + + + +/*____________________________________________________________________________ + Determine key and block size for specified algorithm. Stateless routine + does not need a context. +____________________________________________________________________________*/ +PGPError PGPGetSymmetricCipherSizes( + PGPSymmetricCipherContextRef ref, + PGPSize *keySize , PGPSize *blockSize ); + + + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + + + +#endif /* ] Included_pgpSymmetricCipher_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpTLS.h b/cryptopp/PGPw/sdk6/include/pgpTLS.h new file mode 100644 index 0000000..ec2903a --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpTLS.h @@ -0,0 +1,316 @@ +/*____________________________________________________________________________ + Copyright (C) 1997-1999 Network Associates, Inc. + All rights reserved. + + $Id: pgpTLS.h,v 1.32 1999/01/25 11:31:49 wprice Exp $ +____________________________________________________________________________*/ +#ifndef Included_PGPtls_h /* [ */ +#define Included_PGPtls_h + +#include "pgpPubTypes.h" + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + + +typedef struct PGPtlsContext * PGPtlsContextRef; +typedef const struct PGPtlsContext * PGPtlsConstContextRef; + +#define kInvalidPGPtlsContextRef ((PGPtlsContextRef) NULL) +#define PGPtlsContextRefIsValid( ref ) ( (ref) != kInvalidPGPtlsContextRef ) + +typedef struct PGPtlsSession * PGPtlsSessionRef; +typedef const struct PGPtlsSession * PGPtlsConstSessionRef; + +#define kInvalidPGPtlsSessionRef ((PGPtlsSessionRef) NULL) +#define PGPtlsSessionRefIsValid( ref ) ( (ref) != kInvalidPGPtlsSessionRef ) + + +typedef PGPFlags PGPtlsFlags; +#define kPGPtlsFlags_ServerSide 0x01 +#define kPGPtlsFlags_ClientSide 0x02 +#define kPGPtlsFlags_RequestClientCert 0x04 +#define kPGPtlsFlags_NonBlockingIO 0x08 + +enum PGPtlsCipherSuiteNum_ +{ + kPGPtls_TLS_NULL_WITH_NULL_NULL = 0, + kPGPtls_TLS_PGP_DHE_DSS_WITH_CAST_CBC_SHA = 1, + kPGPtls_TLS_PGP_DHE_RSA_WITH_CAST_CBC_SHA = 2, + kPGPtls_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 3, + kPGPtls_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 4, + kPGPtls_TLS_RSA_WITH_3DES_EDE_CBC_SHA = 5, + kPGPtls_TLS_RSA_WITH_IDEA_CBC_SHA = 6, + kPGPtls_TLS_PGP_RSA_WITH_CAST_CBC_SHA = 7, + kPGPtls_TLS_PGP_DHE_DSS_WITH_NULL_SHA = 8, + kPGPtls_TLS_DHE_DSS_WITH_NULL_SHA = 9, + + PGP_ENUM_FORCE( PGPtlsCipherSuiteNum_ ) +}; +PGPENUM_TYPEDEF( PGPtlsCipherSuiteNum_, PGPtlsCipherSuiteNum ); + +enum PGPtlsProtocolState_ +{ + kPGPtls_IdleState = 0, + kPGPtls_FatalErrorState = 1, + kPGPtls_ClosedState = 2, + kPGPtls_HandshakeState = 3, + kPGPtls_ReadyState = 4, + + PGP_ENUM_FORCE( PGPtlsProtocolState_ ) +}; +PGPENUM_TYPEDEF( PGPtlsProtocolState_, PGPtlsProtocolState ); + +enum PGPtlsPrime_ +{ + kPGPtls_DHPrime1024 = 0, + kPGPtls_DHPrime1536 = 1, + kPGPtls_DHPrime2048 = 2, + kPGPtls_DHPrime3072 = 3, + kPGPtls_DHPrime4096 = 4, + + PGP_ENUM_FORCE( PGPtlsPrime_ ) +}; +PGPENUM_TYPEDEF( PGPtlsPrime_, PGPtlsPrime ); + +enum PGPtlsAlert_ +{ + kPGPtls_AT_CloseNotify = 0, + kPGPtls_AT_UnexpectedMessage = 10, /* FATAL */ + kPGPtls_AT_BadRecordMAC = 20, /* FATAL */ + kPGPtls_AT_DecryptionFailed = 21, /* FATAL */ + kPGPtls_AT_RecordOverflow = 22, /* FATAL */ + kPGPtls_AT_DecompressionFailure = 30, /* FATAL */ + kPGPtls_AT_HandshakeFailure = 40, /* FATAL */ + kPGPtls_AT_NoCertificate = 41, /* SSL3 */ + kPGPtls_AT_BadCertificate = 42, + kPGPtls_AT_UnsupportedCert = 43, + kPGPtls_AT_CertRevoked = 44, + kPGPtls_AT_CertExpired = 45, + kPGPtls_AT_CertUnknown = 46, + kPGPtls_AT_IllegalParameter = 47, /* FATAL */ + kPGPtls_AT_UnknownCA = 48, /* FATAL */ + kPGPtls_AT_AccessDenied = 49, /* FATAL */ + kPGPtls_AT_DecodeError = 50, /* FATAL */ + kPGPtls_AT_DecryptError = 51, + kPGPtls_AT_ExportRestriction = 60, /* FATAL */ + kPGPtls_AT_ProtocolVersion = 70, /* FATAL */ + kPGPtls_AT_InsufficientSecurity = 71, /* FATAL */ + kPGPtls_AT_InternalError = 80, /* FATAL */ + kPGPtls_AT_UserCancelled = 90, + kPGPtls_AT_NoRenegotiation = 100, + + kPGPtls_AT_None = 255, + + PGP_ENUM_FORCE( PGPtlsAlert_ ) +}; +PGPENUM_TYPEDEF( PGPtlsAlert_, PGPtlsAlert ); + +/* The Send and Receive function pointers should return + kPGPError_TLSWouldBlock when the socket is non-blocking and the + call would block. The Send and Receive functions passed in will + need to translate the platform-specific socket error in appropriate + cases by using calls such as WSAGetLastError() on Win32. Remember + to call PGPtlsSendQueueIdle for non-blocking sockets also if + kPGPError_TLSWouldBlock is returned from a send on a non-blocking + socket. */ + +typedef PGPInt32 (* PGPtlsReceiveProcPtr)(void *inData, void *outBuffer, + PGPInt32 inBufferSize); +typedef PGPInt32 (* PGPtlsSendProcPtr)(void *inData, const void *inBuffer, + PGPInt32 inBufferLength); + + +PGPError PGPNewTLSContext( PGPContextRef context, + PGPtlsContextRef *outRef ); + +PGPError PGPFreeTLSContext( PGPtlsContextRef ref ); + +/*____________________________________________________________________________ + The following function activates or deactivates the session key cache + for TLS sessions. This defaults to on but can be deactivated with this + function to force all connections to proceed through the entire + handshake. +____________________________________________________________________________*/ +PGPError PGPtlsSetCache( PGPtlsContextRef ref, PGPBoolean useCache ); + +PGPError PGPtlsClearCache( PGPtlsContextRef ref ); + +PGPError PGPNewTLSSession( PGPtlsContextRef ref, + PGPtlsSessionRef *outRef ); + +PGPError PGPFreeTLSSession( PGPtlsSessionRef ref ); + +PGPError PGPCopyTLSSession( PGPtlsSessionRef ref, PGPtlsSessionRef *outRef ); + +/* Default options are client side and no client cert request */ +PGPError PGPtlsSetProtocolOptions( PGPtlsSessionRef ref, + PGPtlsFlags options ); + + +/*____________________________________________________________________________ + The following function must be called to cleanly close a TLS + connection. If it is not called, the session will not be able + to be resumed from the session cache. + + In the event the application determines any problem with the + connection such as the remote key not being valid, call this + function with dontCache set to true in order to not cache the + session keys. +____________________________________________________________________________*/ +PGPError PGPtlsClose( PGPtlsSessionRef ref, + PGPBoolean dontCache ); + +/*____________________________________________________________________________ + The following function must be called to initiate the PGPtls session. + Once a TLS session has been assigned to a socket, no data can be sent + over that socket by the application until the handshake is completed. + Handshake completion is indicated by completion of this call without + error or by checking the state of the PGPtlsSession. It will be + kPGPtls_ReadyState when the application layer may send and receive + data securely. + + This function performs all negotiation of the TLS connection. +____________________________________________________________________________*/ +PGPError PGPtlsHandshake( PGPtlsSessionRef ref ); + +/*____________________________________________________________________________ + The following function should be called before PGPtlsHandshake. + In the general case, the remoteID will be an IP address. This + is provided to PGPtls in order to allow it to cache the current + session and be able to look it up later. If the remoteID passed + into a future session is the same as a previously cached session, + PGPtls will attempt to resume the session. +____________________________________________________________________________*/ +PGPError PGPtlsSetRemoteUniqueID( PGPtlsSessionRef ref, + PGPUInt32 remoteID ); + +/*____________________________________________________________________________ + The following function sets the local private authenticating key. + + The passphrase and key are retained in memory. By default, no + key is specified and a client side session will return no key in the + client key exchange message to the server. + It is an error not to specify a key on a server side TLS session. + This function must be passed either PGPOPassphrase or PGPOPasskeyBuffer. + You may pass in just a PGP key, PGP w/ X.509 cert, or both -- and they + must be the same -- the cert must be from the key. For an X.509 cert, + the inCertChain keyset must contain the keys of all keys in the + certificate chain for that certificate up to the root. To disable X.509 + certs, simply pass nothing (ie. kPGPInvalidSigRef). The inCertChain + keyset must remain valid for the lifetime of the TLS connection. +____________________________________________________________________________*/ +PGPError PGPtlsSetLocalPrivateKey( PGPtlsSessionRef ref, + PGPKeyRef inKey, + PGPSigRef inX509Cert, + PGPKeySetRef inCertChain, + PGPOptionListRef firstOption, ... ); + +/*____________________________________________________________________________ + The following function sets the preferred cipher suite. + + There is no guarantee that cipher will actually be negotiated, + but it will be attempted in preference to others. +____________________________________________________________________________*/ +PGPError PGPtlsSetPreferredCipherSuite( PGPtlsSessionRef ref, + PGPtlsCipherSuiteNum cipher ); + +/*____________________________________________________________________________ + The following function sets the desired DH prime. + + The requested primes are drawn from a set of primes hard-coded + into PGPtls. New primes can be added in a fully compatible + fashion since the server sends the prime to the client, but this + version of the API does not support passing in a desired prime. The + default prime if this function is not called is kPGPtls_DHPrime2048. +____________________________________________________________________________*/ +PGPError PGPtlsSetDHPrime( PGPtlsSessionRef ref, + PGPtlsPrime prime ); + +/*____________________________________________________________________________ + The following function gets the authenticated remote key after a + successful handshake. You must call this function after a successful + handshake to verify that the remote key is authorized to make the + connection. +____________________________________________________________________________*/ +PGPError PGPtlsGetRemoteAuthenticatedKey( PGPtlsSessionRef ref, + PGPKeyRef * outKey, + PGPKeySetRef * outKeySet ); + +/*____________________________________________________________________________ + The following function returns the negotiated symmetric cipher. + + This function will return an error if called before a successful + handshake. +____________________________________________________________________________*/ +PGPError PGPtlsGetNegotiatedCipherSuite( PGPtlsSessionRef ref, + PGPtlsCipherSuiteNum *outCipher ); + +PGPError PGPtlsGetState( PGPtlsSessionRef ref, + PGPtlsProtocolState *outState ); + +/*____________________________________________________________________________ + The following two functions process data through TLS. + + It is an error to call these functions without having set a + Read function pointer or Write function pointer. Most applications + will never need to use these functions as the function pointers + are automatically configured by PGPsockets, and these functions + are automatically called by the PGPsockets implementations of + PGPWrite and PGPRead whenever a PGPtlsSessionRef has been set for + a given socket. +____________________________________________________________________________*/ +PGPError PGPtlsReceive( PGPtlsSessionRef ref, + void * outBuffer, + PGPSize * bufferSize ); + +PGPError PGPtlsSend( PGPtlsSessionRef ref, + const void * inBuffer, + PGPSize inBufferLength ); + +PGPError PGPtlsSetReceiveCallback( PGPtlsSessionRef ref, + PGPtlsReceiveProcPtr tlsReceiveProc, + void * inData ); + +PGPError PGPtlsSetSendCallback( PGPtlsSessionRef ref, + PGPtlsSendProcPtr tlsSendProc, + void * inData ); + + +/*____________________________________________________________________________ + The following function is necessary *only* on a non-blocking socket. + If a call to PGPtlsSend returns kPGPError_TLSWouldBlock, call + the following function repeatedly until that error is no longer + returned in order to make sure data is sent. Another call to + PGPtlsSend will also call this function automatically and queue + any new data if necessary. +____________________________________________________________________________*/ +PGPError PGPtlsSendQueueIdle( PGPtlsSessionRef ref ); + +PGPSize PGPtlsReceiveBufferSize( PGPtlsSessionRef ref ); + +/*____________________________________________________________________________ + The following function gets the ID of the fatal alert which caused + the TLS session to abort and go into the kPGPtls_FatalErrorState. +____________________________________________________________________________*/ +PGPError PGPtlsGetAlert( PGPtlsSessionRef ref, PGPtlsAlert *outAlert ); + + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + +#endif /* ] Included_PGPtls_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpUserInterface.h b/cryptopp/PGPw/sdk6/include/pgpUserInterface.h new file mode 100644 index 0000000..8d2e05d --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpUserInterface.h @@ -0,0 +1,290 @@ +/*____________________________________________________________________________ + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + This file contains the prototypes for functions which use UI to interact + with the user. + + $Id: pgpUserInterface.h,v 1.40 1999/03/10 02:59:37 heller Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpUserInterface_h /* [ */ +#define Included_pgpUserInterface_h + +#include "pgpPubTypes.h" +#include "pgpGroups.h" + +#if PGP_WIN32 +#include "windows.h" +#endif + +PGP_BEGIN_C_DECLARATIONS + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +#if PRAGMA_ALIGN_SUPPORTED +#pragma options align=mac68k +#endif + +enum PGPAdditionalRecipientRequestEnforcement_ +{ + kPGPARREnforcement_Invalid = 0, + kPGPARREnforcement_None = 1, + kPGPARREnforcement_Warn = 2, + kPGPARREnforcement_Strict = 3, + + PGP_ENUM_FORCE( PGPAdditionalRecipientRequestEnforcement_ ) +}; +PGPENUM_TYPEDEF( PGPAdditionalRecipientRequestEnforcement_, + PGPAdditionalRecipientRequestEnforcement ); + +enum PGPRecipientSpecType_ +{ + kPGPRecipientSpecType_Invalid = 0, + kPGPRecipientSpecType_Key = 1, + kPGPRecipientSpecType_UserID = 2, + kPGPRecipientSpecType_KeyID = 3, + + PGP_ENUM_FORCE( PGPRecipientSpecType_ ) +}; +PGPENUM_TYPEDEF( PGPRecipientSpecType_, PGPRecipientSpecType ); + +typedef struct PGPRecipientSpec +{ + PGPRecipientSpecType type; + PGPBoolean locked; + PGPBoolean reserved8[3]; /* Must be zero */ + PGPUInt32 reserved32[3]; /* Must be zero */ + + union + { + PGPKeyRef key; + char userIDStr[256]; /* Null terminated string */ + + struct + { + PGPKeyID keyID; + PGPPublicKeyAlgorithm algorithm; + } id; + + } u; + +} PGPRecipientSpec; + +typedef struct PGPKeyServerSpec +{ + PGPKeyServerRef server; + const char *serverName; /* Optional */ + PGPUInt32 reserved[5]; /* Must be zero */ + +} PGPKeyServerSpec; + +#if PRAGMA_ALIGN_SUPPORTED +#pragma options align=reset +#endif + +PGPError PGPRecipientDialog( + PGPContextRef context, + PGPKeySetRef allKeys, + PGPBoolean alwaysDisplayDialog, + PGPKeySetRef *recipientKeys, + PGPOptionListRef firstOption, ... ); + +PGPError PGPPassphraseDialog( + PGPContextRef context, + PGPOptionListRef firstOption, ... ); + +PGPError PGPConfirmationPassphraseDialog( + PGPContextRef context, + PGPOptionListRef firstOption, ... ); + +PGPError PGPKeyPassphraseDialog( + PGPContextRef context, + PGPKeyRef theKey, + PGPOptionListRef firstOption, ... ); + +PGPError PGPSigningPassphraseDialog( + PGPContextRef context, + PGPKeySetRef allKeys, + PGPKeyRef *signingKey, + PGPOptionListRef firstOption, ... ); + +PGPError PGPDecryptionPassphraseDialog( + PGPContextRef context, + PGPKeySetRef recipientKeys, + PGPUInt32 keyIDCount, + const PGPKeyID keyIDList[], + PGPKeyRef *decryptionKey, + PGPOptionListRef firstOption, ... ); + +PGPError PGPConventionalEncryptionPassphraseDialog( + PGPContextRef context, + PGPOptionListRef firstOption, ... ); + +PGPError PGPConventionalDecryptionPassphraseDialog( + PGPContextRef context, + PGPOptionListRef firstOption, ... ); + +PGPError PGPOptionsDialog( + PGPContextRef context, + PGPOptionListRef firstOption, ... ); + +PGPError PGPCollectRandomDataDialog( + PGPContextRef context, + PGPUInt32 neededEntropyBits, + PGPOptionListRef firstOption, ... ); + +PGPError PGPSearchKeyServerDialog( + PGPContextRef context, + PGPUInt32 serverCount, + const PGPKeyServerSpec serverList[], + PGPtlsContextRef tlsContext, + PGPBoolean searchAllServers, + PGPKeySetRef *foundKeys, + PGPOptionListRef firstOption, ... ); + +PGPError PGPSendToKeyServerDialog( + PGPContextRef context, + const PGPKeyServerSpec *server, + PGPtlsContextRef tlsContext, + PGPKeySetRef keysToSend, + PGPKeySetRef *failedKeys, + PGPOptionListRef firstOption, ... ); + +/* +** Returns a value in the range 0-100 which crudely estimates +** the "quality" of a passphrase. +*/ + +PGPUInt32 PGPEstimatePassphraseQuality(const char *passphrase); + +/* General dialog options */ + +PGPOptionListRef PGPOUIDialogPrompt(PGPContextRef context, + const char *prompt); + +PGPOptionListRef PGPOUIWindowTitle(PGPContextRef context, + const char *title); + +PGPOptionListRef PGPOUIDialogOptions(PGPContextRef context, + PGPOptionListRef firstOption, ...); + +#if PGP_WIN32 +PGPOptionListRef PGPOUIParentWindowHandle(PGPContextRef context, + HWND hwndParent); +#endif + +/* All passphrase dialogs */ + +/* Caller should free passphrase with PGPFreeData() */ +PGPOptionListRef PGPOUIOutputPassphrase(PGPContextRef context, + char **passphrase); + +PGPOptionListRef PGPOUIMinimumPassphraseQuality(PGPContextRef context, + PGPUInt32 minimumPassphraseQuality); + +PGPOptionListRef PGPOUIMinimumPassphraseLength(PGPContextRef context, + PGPUInt32 minimumPassphraseLength); + +/* PGPConfirmationPassphraseDialog() options */ + +PGPOptionListRef PGPOUIShowPassphraseQuality(PGPContextRef context, + PGPBoolean showPassphraseQuality); + +/* PGPSigningPassphraseDialog() and PGPDecryptionPassphraseDialog() options */ + +PGPOptionListRef PGPOUIDefaultKey(PGPContextRef context, + PGPKeyRef defaultKey); + +PGPOptionListRef PGPOUIVerifyPassphrase(PGPContextRef context, + PGPBoolean verifyPassphrase); + +PGPOptionListRef PGPOUIFindMatchingKey(PGPContextRef context, + PGPBoolean findMatchingKey); + +PGPOptionListRef PGPOUITextUI(PGPContextRef context, PGPBoolean textUI); + +/* PGPRecipientDialog() options: */ + +PGPOptionListRef PGPOUIRecipientList(PGPContextRef context, + PGPUInt32 *recipientCount, + PGPRecipientSpec **recipientList); + +PGPOptionListRef PGPOUIDefaultRecipients(PGPContextRef context, + PGPUInt32 recipientCount, + const PGPRecipientSpec recipientList[]); + +PGPOptionListRef PGPOUIDisplayMarginalValidity(PGPContextRef context, + PGPBoolean displayMarginalValidity); + +PGPOptionListRef PGPOUIIgnoreMarginalValidity(PGPContextRef context, + PGPBoolean ignoreMarginalValidity); + +PGPOptionListRef PGPOUIRecipientGroups(PGPContextRef context, + PGPGroupSetRef groupSet); + +PGPOptionListRef PGPOUIEnforceAdditionalRecipientRequests( + PGPContextRef context, + PGPAdditionalRecipientRequestEnforcement enforcement, + PGPBoolean alwaysDisplayDialogWithARRs); + +/* PGPDecryptionPassphraseDialog() and PGPRecipientDialog() only: */ + +PGPOptionListRef PGPOUIKeyServerUpdateParams(PGPContextRef context, + PGPUInt32 serverCount, + const PGPKeyServerSpec serverList[], + PGPtlsContextRef tlsContext, + PGPBoolean searchBeforeDisplay, + PGPKeySetRef *foundKeys, + PGPOptionListRef firstOption, ...); + +/* Key server search dialog options */ + +PGPOptionListRef PGPOUIKeyServerSearchFilter(PGPContextRef context, + PGPFilterRef filter); + +PGPOptionListRef PGPOUIKeyServerSearchKey(PGPContextRef context, + PGPKeyRef key); + +PGPOptionListRef PGPOUIKeyServerSearchKeySet(PGPContextRef context, + PGPKeySetRef keySet); + +PGPOptionListRef PGPOUIKeyServerSearchKeyIDList(PGPContextRef context, + PGPUInt32 keyIDCount, const PGPKeyID keyIDList[] ); + +/* +** These options are used to build the options dialog and are only +** applicable for the PGPOptionsDialog() and PGPOUIDialogOptions() calls. +** The "description" parameters are optional. +*/ + +PGPOptionListRef PGPOUICheckbox(PGPContextRef context, PGPUInt32 itemID, + const char *title, const char *description, + PGPUInt32 initialValue, PGPUInt32 *resultPtr, + PGPOptionListRef firstOption, ...); + +PGPOptionListRef PGPOUIPopupList(PGPContextRef context, PGPUInt32 itemID, + const char *title, const char *description, + PGPUInt32 listItemCount, const char *listItems[], + PGPUInt32 initialValue, PGPUInt32 *resultPtr, + PGPOptionListRef firstOption, ...); + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif + +PGP_END_C_DECLARATIONS + +#endif /* ] Included_pgpUserInterface_h */ + + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ diff --git a/cryptopp/PGPw/sdk6/include/pgpUtilities.h b/cryptopp/PGPw/sdk6/include/pgpUtilities.h new file mode 100644 index 0000000..d92c999 --- /dev/null +++ b/cryptopp/PGPw/sdk6/include/pgpUtilities.h @@ -0,0 +1,231 @@ +/*____________________________________________________________________________ + pgpUtilities.h + + Copyright (C) 1997 Network Associates Inc. and affiliated companies. + All rights reserved. + + This file contains miscellaneous utility functions needed for the PGPsdk. + + $Id: pgpUtilities.h,v 1.68 1999/03/25 01:46:38 heller Exp $ +____________________________________________________________________________*/ + +#ifndef Included_pgpUtilities_h /* [ */ +#define Included_pgpUtilities_h + +#if PGP_MACINTOSH /* [ */ +#include +#endif /* ] PGP_MACINTOSH */ + +#include "pgpPubTypes.h" +#include "pgpMemoryMgr.h" + +#include + + +#if PRAGMA_ALIGN_SUPPORTED +#pragma options align=mac68k /* [ */ +#endif + + +#if PGP_MACINTOSH /* [ */ + +#define kPGPMacFileCreator_Keys 'pgpK' +#define kPGPMacFileCreator_DecryptedBinary '????' +#define kPGPMacFileCreator_DecryptedText 'ttxt' +#define kPGPMacFileCreator_Tools 'pgpM' + +#define kPGPMacFileType_ArmorFile 'TEXT' +#define kPGPMacFileType_EncryptedData 'pgEF' +#define kPGPMacFileType_SignedData 'pgSF' +#define kPGPMacFileType_DetachedSig 'pgDS' +#define kPGPMacFileType_RandomSeed 'pgRS' +#define kPGPMacFileType_PrivRing 'pgRR' +#define kPGPMacFileType_PubRing 'pgPR' +#define kPGPMacFileType_Groups 'pgGR' +#define kPGPMacFileType_Preferences 'pref' +#define kPGPMacFileType_DecryptedText 'TEXT' +#define kPGPMacFileType_DecryptedBinary 'BINA' +#define kPGPMacFileType_KeyShares 'pgSK' +#define kPGPMacFileType_Exported509Keys 'pgX5' + +#endif /* ] PGP_MACINTOSH */ + +PGP_BEGIN_C_DECLARATIONS +#if PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +/*____________________________________________________________________________ + Context routines +____________________________________________________________________________*/ + +/*____________________________________________________________________________ + API version: + Top byte is major, next 3 nibbles minor, next 2 bug fix, + last nibble reserved: 0xMMmmmrrR + + example: 1.0.0 = 0x01000000 + + 0x01000000 SDK 1.0.0 + 0x02000000 SDK 1.1.0 + 0x02000010 SDK 1.1.1 + 0x03000000 SDK 1.5 + 0x03000010 SDK 1.5.1 + 0x03000020 SDK 1.5.2 + 0x03001000 SDK 1.6 + 0x03002000 SDK 1.7 + 0x03002010 SDK 1.7.1 +_____________________________________________________________________________*/ +#define kPGPsdkAPIVersion ( (PGPUInt32)0x03002010 ) +#define PGPMajorVersion( v ) ( ( ((PGPUInt32)(v)) & 0xFF000000 ) >> 24 ) +#define PGPMinorVersion( v ) ( ( ((PGPUInt32)(v)) & 0x00FFF000 ) >> 16 ) +#define PGPRevVersion( v ) ( ( ((PGPUInt32)(v)) & 0x00000FF0 ) >> 4 ) + +typedef struct PGPNewContextStruct +{ + /* sizeofStruct must be inited to sizeof( PGPNewContextStruct ) */ + PGPUInt32 sizeofStruct; + PGPMemoryMgrRef memoryMgr; +} PGPNewContextStruct; + + + +/* always pass kPGPsdkVersion */ +PGPError PGPNewContext( PGPUInt32 clientAPIVersion, + PGPContextRef *newContext ); +PGPError PGPNewContextCustom( PGPUInt32 clientAPIVersion, + PGPNewContextStruct const *custom, + PGPContextRef *newContext ); + +PGPError PGPFreeContext( PGPContextRef context ); + +PGPError PGPGetContextUserValue( PGPContextRef context, + PGPUserValue *userValue ); +PGPError PGPSetContextUserValue( PGPContextRef context, + PGPUserValue userValue ); + +PGPError PGPContextGetRandomBytes(PGPContextRef context, + void *buf, PGPSize len ); + + +PGPMemoryMgrRef PGPGetContextMemoryMgr( PGPContextRef context ); + + + +/*____________________________________________________________________________ + FileRefs +____________________________________________________________________________*/ + +PGPError PGPCopyFileSpec(PGPFileSpecRef fileRef, + PGPFileSpecRef *ref); +PGPError PGPFreeFileSpec(PGPFileSpecRef fileRef); + +#if PGP_MACINTOSH /* [ */ + +PGPError PGPNewFileSpecFromFSSpec(PGPContextRef context, + const FSSpec *spec, PGPFileSpecRef *ref); +PGPError PGPGetFSSpecFromFileSpec(PGPFileSpecRef fileRef, + FSSpec *spec); +#else + +PGPError PGPNewFileSpecFromFullPath( PGPContextRef context, + char const *path, PGPFileSpecRef *ref); + +/* *fullPathPtr ***must*** be freed with PGPFreeData */ +PGPError PGPGetFullPathFromFileSpec( PGPFileSpecRef fileRef, + char ** fullPathPtr); + +#endif /* ] PGP_MACINTOSH */ + + + +/*____________________________________________________________________________ + Time +____________________________________________________________________________*/ +PGPTime PGPGetTime(void); + +/* these use time_t type as returned by time() in Std C libraries */ +time_t PGPGetStdTimeFromPGPTime(PGPTime theTime); +PGPTime PGPGetPGPTimeFromStdTime(time_t theTime); + + +/* year, month, day may be NULL if desired */ +void PGPGetYMDFromPGPTime( PGPTime theTime, + PGPUInt16 *year, PGPUInt16 *month, PGPUInt16 *day ); + + +#if PGP_MACINTOSH /* [ */ +PGPUInt32 PGPTimeToMacTime(PGPTime theTime); +PGPTime PGPTimeFromMacTime(PGPUInt32 theTime); +#endif /* ] PGP_MACINTOSH */ + + + +/*____________________________________________________________________________ + MacBinary support +____________________________________________________________________________*/ + + +/*____________________________________________________________________________ + Examine the input file to see if it's a MacBinary file. If it is + not a MacBinary file, then the original file is unaltered. + Otherwise, the file is converted and the original file is deleted. + + The resulting file is designated by 'outPGPSpec' and may have a different + name than the original. + + If the file is a TEXT file, appropriate line-end conversion is done. + + creator and type code pointers may be + null but otherwise contain the mac creator and type. + + This routine can be called on a Mac, but generally doesn't need to be. +____________________________________________________________________________*/ +PGPError PGPMacBinaryToLocal( PGPFileSpecRef inSpec, + PGPFileSpecRef * outSpec, + PGPUInt32 * macCreator, PGPUInt32 * macTypeCode ); + + + + +/*____________________________________________________________________________ + Library initialization + + Call PGPsdkXXXInit() before using that particular library. + Call PGPsdkXXXCleanup() when you are done (but after disposing of any + PGPContexts). + + You may call PGPsdkXXXInit multiple times (with no effect), but be sure + to call the matching PGPsdkXXXCleanup() for each call to PGPsdkXXXInit(). +____________________________________________________________________________*/ + +PGPError PGPsdkInit( void ); +PGPError PGPsdkCleanup( void ); + +PGPError PGPsdkNetworkLibInit( void ); +PGPError PGPsdkNetworkLibCleanup( void ); + +PGPError PGPsdkUILibInit( void ); +PGPError PGPsdkUILibCleanup( void ); + +#if PRAGMA_IMPORT_SUPPORTED +#pragma import reset +#endif +PGP_END_C_DECLARATIONS + + + +#if PRAGMA_ALIGN_SUPPORTED +#pragma options align=reset /* ] */ +#endif + +#endif /* ] Included_pgpUtilities_h */ + +/*__Editor_settings____ + + Local Variables: + tab-width: 4 + End: + vi: ts=4 sw=4 + vim: si +_____________________*/ -- cgit v1.2.3