summaryrefslogtreecommitdiff
path: root/plugins/CryptoPP/PGPw/sdk8/include/pgpFeatures.h
blob: ad628a283b4719f7b092990e7c64b43f8a732570 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*____________________________________________________________________________
	Copyright (C) 2002 PGP Corporation
	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.13 2004/03/15 19:18:55 vinnie Exp $
____________________________________________________________________________*/

#ifndef Included_pgpFeatures_h	/* [ */
#define Included_pgpFeatures_h

#include "pgpPubTypes.h"

#if PGP_MACINTOSH
#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			= (1UL << 0),
	kPGPFeatureMask_CanDecrypt			= (1UL << 1),
	kPGPFeatureMask_CanSign				= (1UL << 2),
	kPGPFeatureMask_CanVerify			= (1UL << 3),
	kPGPFeatureMask_CanGenerateKey		= (1UL << 4),
	kPGPFeatureMask_RngHardware			= (1UL << 5),
	kPGPFeatureMask_FIPSmode			= (1UL << 6)
};

/* flags for kPGPFeatures_ImplementationSelector */
enum
{
	kPGPFeatureMask_IsDebugBuild	= (1UL << 0),
	kPGPFeatureMask_HasTimeout		= (1UL << 0)
};

#define kPGPAlgorithmInfoFlags_FIPS		(PGPFlags)(1UL << 1 )

typedef struct PGPAlgorithmInfo
{
	PGPChar8	shortName[ 32 ];
	PGPChar8	longName[ 96 ];
	PGPChar8	copyright[ 128 ];
	PGPFlags	flags;			 
	PGPUInt32	reserved[ 16 ];	/* reserved; 0 for now */
	
} PGPAlgorithmInfo;

typedef struct PGPPublicKeyAlgorithmInfo
{
	PGPAlgorithmInfo		info;
	
	PGPPublicKeyAlgorithm	algID;
	
	PGPBoolean				canEncrypt;
	PGPBoolean				canDecrypt;
	PGPBoolean				canSign;
	PGPBoolean				canVerify;
	PGPBoolean				canGenerateKey;
	PGPBoolean				reserved1;
	PGPBoolean				reserved2;
	PGPBoolean				reserved3;
	
	PGPUInt32				reserved[ 8 ];
	
} PGPPublicKeyAlgorithmInfo;

typedef struct PGPSymmetricCipherInfo
{
	PGPAlgorithmInfo	info;
	PGPCipherAlgorithm	algID;
	
	PGPUInt32			reserved[ 8 ];
	
} PGPSymmetricCipherInfo;

#if PGP_MACINTOSH
#pragma options align=reset			/* ] */
#endif

PGP_BEGIN_C_DECLARATIONS

/* 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);

PGP_END_C_DECLARATIONS

#endif /* ] Included_pgpFeatures_h */

/*__Editor_settings____

	Local Variables:
	tab-width: 4
	End:
	vi: ts=4 sw=4
	vim: si
_____________________*/