xref: /onnv-gate/usr/src/lib/libkmsagent/common/KMSClientProfile.h (revision 12720:3db6e0082404)
1*12720SWyllys.Ingersoll@Sun.COM /*
2*12720SWyllys.Ingersoll@Sun.COM  * CDDL HEADER START
3*12720SWyllys.Ingersoll@Sun.COM  *
4*12720SWyllys.Ingersoll@Sun.COM  * The contents of this file are subject to the terms of the
5*12720SWyllys.Ingersoll@Sun.COM  * Common Development and Distribution License (the "License").
6*12720SWyllys.Ingersoll@Sun.COM  * You may not use this file except in compliance with the License.
7*12720SWyllys.Ingersoll@Sun.COM  *
8*12720SWyllys.Ingersoll@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*12720SWyllys.Ingersoll@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*12720SWyllys.Ingersoll@Sun.COM  * See the License for the specific language governing permissions
11*12720SWyllys.Ingersoll@Sun.COM  * and limitations under the License.
12*12720SWyllys.Ingersoll@Sun.COM  *
13*12720SWyllys.Ingersoll@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*12720SWyllys.Ingersoll@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*12720SWyllys.Ingersoll@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*12720SWyllys.Ingersoll@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*12720SWyllys.Ingersoll@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*12720SWyllys.Ingersoll@Sun.COM  *
19*12720SWyllys.Ingersoll@Sun.COM  * CDDL HEADER END
20*12720SWyllys.Ingersoll@Sun.COM  */
21*12720SWyllys.Ingersoll@Sun.COM 
22*12720SWyllys.Ingersoll@Sun.COM /*
23*12720SWyllys.Ingersoll@Sun.COM  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24*12720SWyllys.Ingersoll@Sun.COM  */
25*12720SWyllys.Ingersoll@Sun.COM 
26*12720SWyllys.Ingersoll@Sun.COM /*-------------------------------------------------------------------------*/
27*12720SWyllys.Ingersoll@Sun.COM /**
28*12720SWyllys.Ingersoll@Sun.COM  * \file      KMSClientProfile.h
29*12720SWyllys.Ingersoll@Sun.COM  *
30*12720SWyllys.Ingersoll@Sun.COM  * The KMS Client profile management API, including profile setup, CA
31*12720SWyllys.Ingersoll@Sun.COM  * certificate download, and Certificate retrieval
32*12720SWyllys.Ingersoll@Sun.COM  *
33*12720SWyllys.Ingersoll@Sun.COM  */
34*12720SWyllys.Ingersoll@Sun.COM /*-------------------------------------------------------------------------*/
35*12720SWyllys.Ingersoll@Sun.COM 
36*12720SWyllys.Ingersoll@Sun.COM #ifndef KMSCLIENT_PROFILE_H
37*12720SWyllys.Ingersoll@Sun.COM #define KMSCLIENT_PROFILE_H
38*12720SWyllys.Ingersoll@Sun.COM 
39*12720SWyllys.Ingersoll@Sun.COM #ifdef __cplusplus
40*12720SWyllys.Ingersoll@Sun.COM extern "C" {
41*12720SWyllys.Ingersoll@Sun.COM #endif
42*12720SWyllys.Ingersoll@Sun.COM 
43*12720SWyllys.Ingersoll@Sun.COM #ifndef KMS_LONG_LONG
44*12720SWyllys.Ingersoll@Sun.COM #define KMS_LONG_LONG
45*12720SWyllys.Ingersoll@Sun.COM 
46*12720SWyllys.Ingersoll@Sun.COM #ifdef WIN32
47*12720SWyllys.Ingersoll@Sun.COM   typedef __int64 Long64;
48*12720SWyllys.Ingersoll@Sun.COM #else
49*12720SWyllys.Ingersoll@Sun.COM   typedef long long Long64;
50*12720SWyllys.Ingersoll@Sun.COM #endif
51*12720SWyllys.Ingersoll@Sun.COM 
52*12720SWyllys.Ingersoll@Sun.COM 
53*12720SWyllys.Ingersoll@Sun.COM #endif
54*12720SWyllys.Ingersoll@Sun.COM 
55*12720SWyllys.Ingersoll@Sun.COM #ifdef KMSUSERPKCS12
56*12720SWyllys.Ingersoll@Sun.COM #define	CLIENT_PK12_FILE	"clientkey.p12"
57*12720SWyllys.Ingersoll@Sun.COM #endif
58*12720SWyllys.Ingersoll@Sun.COM 
59*12720SWyllys.Ingersoll@Sun.COM /**
60*12720SWyllys.Ingersoll@Sun.COM  *  \note UTF-8 encoding is used for the underlying SOAP RPC transactions by
61*12720SWyllys.Ingersoll@Sun.COM  *  this API. In order to support environments lacking wchar.h
62*12720SWyllys.Ingersoll@Sun.COM  *  traditional C strings are used instead.
63*12720SWyllys.Ingersoll@Sun.COM  */
64*12720SWyllys.Ingersoll@Sun.COM typedef char * utf8cstr;
65*12720SWyllys.Ingersoll@Sun.COM 
66*12720SWyllys.Ingersoll@Sun.COM /**
67*12720SWyllys.Ingersoll@Sun.COM  *  @see commments for utf8cstr.
68*12720SWyllys.Ingersoll@Sun.COM  */
69*12720SWyllys.Ingersoll@Sun.COM typedef char utf8char;
70*12720SWyllys.Ingersoll@Sun.COM 
71*12720SWyllys.Ingersoll@Sun.COM /**
72*12720SWyllys.Ingersoll@Sun.COM  *  KMS Agent Toolkit Version identifier
73*12720SWyllys.Ingersoll@Sun.COM  */
74*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_VERSION 0x210
75*12720SWyllys.Ingersoll@Sun.COM 
76*12720SWyllys.Ingersoll@Sun.COM /*---------------------------------------------------------------------------
77*12720SWyllys.Ingersoll@Sun.COM  * Limits and sizes
78*12720SWyllys.Ingersoll@Sun.COM  *--------------------------------------------------------------------------*/
79*12720SWyllys.Ingersoll@Sun.COM /**
80*12720SWyllys.Ingersoll@Sun.COM  *   The maximum length of an agent name.
81*12720SWyllys.Ingersoll@Sun.COM  */
82*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_AGENT_NAME                                                  64
83*12720SWyllys.Ingersoll@Sun.COM 
84*12720SWyllys.Ingersoll@Sun.COM /**
85*12720SWyllys.Ingersoll@Sun.COM  *  The size of a data unit ID in bytes.
86*12720SWyllys.Ingersoll@Sun.COM  */
87*12720SWyllys.Ingersoll@Sun.COM #define KMS_DATA_UNIT_ID_SIZE                                               16
88*12720SWyllys.Ingersoll@Sun.COM 
89*12720SWyllys.Ingersoll@Sun.COM /**
90*12720SWyllys.Ingersoll@Sun.COM  *  The maximum lenght of a description for key group or data unit.
91*12720SWyllys.Ingersoll@Sun.COM  */
92*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_DESCRIPTION                                                 64
93*12720SWyllys.Ingersoll@Sun.COM 
94*12720SWyllys.Ingersoll@Sun.COM /**
95*12720SWyllys.Ingersoll@Sun.COM  *  The maximum maximum length of an external unique id.
96*12720SWyllys.Ingersoll@Sun.COM  */
97*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_EXTERNAL_UNIQUE_ID_SIZE                                     32
98*12720SWyllys.Ingersoll@Sun.COM 
99*12720SWyllys.Ingersoll@Sun.COM /**
100*12720SWyllys.Ingersoll@Sun.COM  *  The maximum external tag length.
101*12720SWyllys.Ingersoll@Sun.COM  */
102*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_EXTERNAL_TAG                                                64
103*12720SWyllys.Ingersoll@Sun.COM 
104*12720SWyllys.Ingersoll@Sun.COM /**
105*12720SWyllys.Ingersoll@Sun.COM  *  The size of a key ID in bytes.
106*12720SWyllys.Ingersoll@Sun.COM  */
107*12720SWyllys.Ingersoll@Sun.COM #define KMS_KEY_ID_SIZE                                                     30
108*12720SWyllys.Ingersoll@Sun.COM 
109*12720SWyllys.Ingersoll@Sun.COM /**
110*12720SWyllys.Ingersoll@Sun.COM  *  The size of an AES Key Wrapping Key ID.
111*12720SWyllys.Ingersoll@Sun.COM  */
112*12720SWyllys.Ingersoll@Sun.COM #define KMS_KWK_KEY_ID_SIZE                                                 8
113*12720SWyllys.Ingersoll@Sun.COM 
114*12720SWyllys.Ingersoll@Sun.COM /**
115*12720SWyllys.Ingersoll@Sun.COM  *  The maximum size of a key in bytes.
116*12720SWyllys.Ingersoll@Sun.COM  */
117*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_KEY_SIZE                                                    32
118*12720SWyllys.Ingersoll@Sun.COM 
119*12720SWyllys.Ingersoll@Sun.COM /**
120*12720SWyllys.Ingersoll@Sun.COM  *  The maximum size of an wrapped key(RFC3394 AES Key Wrap) in bytes.
121*12720SWyllys.Ingersoll@Sun.COM  */
122*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_WRAPPED_KEY_SIZE                                   KMS_MAX_KEY_SIZE+8
123*12720SWyllys.Ingersoll@Sun.COM 
124*12720SWyllys.Ingersoll@Sun.COM /**
125*12720SWyllys.Ingersoll@Sun.COM  *  The maximum length of a key group ID.
126*12720SWyllys.Ingersoll@Sun.COM  */
127*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_KEY_GROUP_ID_SIZE                                           64
128*12720SWyllys.Ingersoll@Sun.COM 
129*12720SWyllys.Ingersoll@Sun.COM /**
130*12720SWyllys.Ingersoll@Sun.COM  *  The maximum size of a key group list to be returned.  This should
131*12720SWyllys.Ingersoll@Sun.COM  *  be sufficient for agents as this is an atypical call.
132*12720SWyllys.Ingersoll@Sun.COM  */
133*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_LIST_KEY_GROUPS                                             100
134*12720SWyllys.Ingersoll@Sun.COM 
135*12720SWyllys.Ingersoll@Sun.COM /**
136*12720SWyllys.Ingersoll@Sun.COM  * The maximum number of keys returned in a key list.
137*12720SWyllys.Ingersoll@Sun.COM  */
138*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_PAGE_SIZE                                                   32
139*12720SWyllys.Ingersoll@Sun.COM 
140*12720SWyllys.Ingersoll@Sun.COM /**
141*12720SWyllys.Ingersoll@Sun.COM  *  The maximum passphrase length.
142*12720SWyllys.Ingersoll@Sun.COM  */
143*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_PASSPHRASE                                                  64
144*12720SWyllys.Ingersoll@Sun.COM 
145*12720SWyllys.Ingersoll@Sun.COM /**
146*12720SWyllys.Ingersoll@Sun.COM  *  The maximum length of agent's name, aka ID.
147*12720SWyllys.Ingersoll@Sun.COM  */
148*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_ENTITY_ID                           64
149*12720SWyllys.Ingersoll@Sun.COM 
150*12720SWyllys.Ingersoll@Sun.COM /**
151*12720SWyllys.Ingersoll@Sun.COM  *  The maximum length of an agent's sited ID.
152*12720SWyllys.Ingersoll@Sun.COM  */
153*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_ENTITY_SITE_ID                      64
154*12720SWyllys.Ingersoll@Sun.COM 
155*12720SWyllys.Ingersoll@Sun.COM /**
156*12720SWyllys.Ingersoll@Sun.COM  *  The maximum length of a URL.
157*12720SWyllys.Ingersoll@Sun.COM  */
158*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_URL                                 512
159*12720SWyllys.Ingersoll@Sun.COM 
160*12720SWyllys.Ingersoll@Sun.COM /**
161*12720SWyllys.Ingersoll@Sun.COM  *  The maximum length of a filter parameter field name.
162*12720SWyllys.Ingersoll@Sun.COM  */
163*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_FIELD_NAME                          64
164*12720SWyllys.Ingersoll@Sun.COM 
165*12720SWyllys.Ingersoll@Sun.COM /**
166*12720SWyllys.Ingersoll@Sun.COM  *  The maximum length of a query parameter sort field value.
167*12720SWyllys.Ingersoll@Sun.COM  */
168*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_FIELD_VALUE                         64
169*12720SWyllys.Ingersoll@Sun.COM 
170*12720SWyllys.Ingersoll@Sun.COM /**
171*12720SWyllys.Ingersoll@Sun.COM  *  The maximum ID length used in various types of IDs.
172*12720SWyllys.Ingersoll@Sun.COM  */
173*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_ID                                  64
174*12720SWyllys.Ingersoll@Sun.COM 
175*12720SWyllys.Ingersoll@Sun.COM /**
176*12720SWyllys.Ingersoll@Sun.COM  *  The maximum length of a KMA network address, either IPv4 or IPv6.
177*12720SWyllys.Ingersoll@Sun.COM  *  Also maximum hostname length if/when hostnames are supported
178*12720SWyllys.Ingersoll@Sun.COM  */
179*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_NETWORK_ADDRESS                     256
180*12720SWyllys.Ingersoll@Sun.COM 
181*12720SWyllys.Ingersoll@Sun.COM /**
182*12720SWyllys.Ingersoll@Sun.COM  *  The maximum length of a file name.
183*12720SWyllys.Ingersoll@Sun.COM  */
184*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_FILE_NAME                           256
185*12720SWyllys.Ingersoll@Sun.COM 
186*12720SWyllys.Ingersoll@Sun.COM /**
187*12720SWyllys.Ingersoll@Sun.COM  *  The maximum length of error strings.
188*12720SWyllys.Ingersoll@Sun.COM  */
189*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_ERROR_STRING                        1024
190*12720SWyllys.Ingersoll@Sun.COM 
191*12720SWyllys.Ingersoll@Sun.COM /**
192*12720SWyllys.Ingersoll@Sun.COM  *  the number of nodes in a KMS is variable.  This constant
193*12720SWyllys.Ingersoll@Sun.COM  * dictates how many of the KMAs in a KMS will be saved to the
194*12720SWyllys.Ingersoll@Sun.COM  * profile, persisted to storage and used for load balancing and failover.  See
195*12720SWyllys.Ingersoll@Sun.COM  * <code>KMSAgent_GetClusterInformation</code>
196*12720SWyllys.Ingersoll@Sun.COM  * Range: 1 .. max int, users should con
197*12720SWyllys.Ingersoll@Sun.COM  */
198*12720SWyllys.Ingersoll@Sun.COM #ifndef KMS_MAX_CLUSTER_NUM
199*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_CLUSTER_NUM                         20
200*12720SWyllys.Ingersoll@Sun.COM #endif
201*12720SWyllys.Ingersoll@Sun.COM 
202*12720SWyllys.Ingersoll@Sun.COM /**
203*12720SWyllys.Ingersoll@Sun.COM  *  The maximum length for SHA1 hashes used in authentication.
204*12720SWyllys.Ingersoll@Sun.COM  */
205*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_HASH_SIZE                           20
206*12720SWyllys.Ingersoll@Sun.COM 
207*12720SWyllys.Ingersoll@Sun.COM /**
208*12720SWyllys.Ingersoll@Sun.COM  *  The maximum length of a KMS verstion string.
209*12720SWyllys.Ingersoll@Sun.COM  */
210*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_VERSION_LENGTH                      100
211*12720SWyllys.Ingersoll@Sun.COM 
212*12720SWyllys.Ingersoll@Sun.COM /**
213*12720SWyllys.Ingersoll@Sun.COM  *  The maximum length of working directory.
214*12720SWyllys.Ingersoll@Sun.COM  */
215*12720SWyllys.Ingersoll@Sun.COM #define KMS_MAX_PATH_LENGTH                         1024
216*12720SWyllys.Ingersoll@Sun.COM 
217*12720SWyllys.Ingersoll@Sun.COM /**
218*12720SWyllys.Ingersoll@Sun.COM  *  typedef for Key ID
219*12720SWyllys.Ingersoll@Sun.COM  */
220*12720SWyllys.Ingersoll@Sun.COM typedef unsigned char KEY_ID [KMS_KEY_ID_SIZE];
221*12720SWyllys.Ingersoll@Sun.COM 
222*12720SWyllys.Ingersoll@Sun.COM /**
223*12720SWyllys.Ingersoll@Sun.COM  *  typedef for an unwrapped Key
224*12720SWyllys.Ingersoll@Sun.COM  */
225*12720SWyllys.Ingersoll@Sun.COM typedef unsigned char KEY [KMS_MAX_KEY_SIZE];
226*12720SWyllys.Ingersoll@Sun.COM 
227*12720SWyllys.Ingersoll@Sun.COM /**
228*12720SWyllys.Ingersoll@Sun.COM  *  typedef for an AES wrapped key
229*12720SWyllys.Ingersoll@Sun.COM  */
230*12720SWyllys.Ingersoll@Sun.COM typedef unsigned char WRAPPED_KEY [KMS_MAX_WRAPPED_KEY_SIZE];
231*12720SWyllys.Ingersoll@Sun.COM 
232*12720SWyllys.Ingersoll@Sun.COM /**
233*12720SWyllys.Ingersoll@Sun.COM  *  typedef for KMSClusterEntry struct
234*12720SWyllys.Ingersoll@Sun.COM  */
235*12720SWyllys.Ingersoll@Sun.COM typedef struct KMSClusterEntry KMSClusterEntry;
236*12720SWyllys.Ingersoll@Sun.COM 
237*12720SWyllys.Ingersoll@Sun.COM /** \struct KMSClusterEntry
238*12720SWyllys.Ingersoll@Sun.COM  *  A struct representing each Key Management Appliance discovered in the KMS cluster
239*12720SWyllys.Ingersoll@Sun.COM  */
240*12720SWyllys.Ingersoll@Sun.COM struct KMSClusterEntry
241*12720SWyllys.Ingersoll@Sun.COM {
242*12720SWyllys.Ingersoll@Sun.COM     /**
243*12720SWyllys.Ingersoll@Sun.COM      *   The KMA's identifier.
244*12720SWyllys.Ingersoll@Sun.COM      */
245*12720SWyllys.Ingersoll@Sun.COM     Long64      m_lApplianceID;
246*12720SWyllys.Ingersoll@Sun.COM 
247*12720SWyllys.Ingersoll@Sun.COM     /**
248*12720SWyllys.Ingersoll@Sun.COM      *   The KMA's name.
249*12720SWyllys.Ingersoll@Sun.COM      */
250*12720SWyllys.Ingersoll@Sun.COM     utf8char    m_wsApplianceAlias[KMS_MAX_ENTITY_ID + 1];
251*12720SWyllys.Ingersoll@Sun.COM 
252*12720SWyllys.Ingersoll@Sun.COM     /**
253*12720SWyllys.Ingersoll@Sun.COM      *  The Sited ID for the KMA.
254*12720SWyllys.Ingersoll@Sun.COM      */
255*12720SWyllys.Ingersoll@Sun.COM     utf8char    m_wsApplianceSiteID[KMS_MAX_ENTITY_SITE_ID + 1];
256*12720SWyllys.Ingersoll@Sun.COM 
257*12720SWyllys.Ingersoll@Sun.COM     /**
258*12720SWyllys.Ingersoll@Sun.COM      *  A network address for the KMA that corresponds to the agent's network.
259*12720SWyllys.Ingersoll@Sun.COM      *  KMAs are multi-homed so only an address useful to the agent is provided.
260*12720SWyllys.Ingersoll@Sun.COM      */
261*12720SWyllys.Ingersoll@Sun.COM     utf8char    m_wsApplianceNetworkAddress[KMS_MAX_NETWORK_ADDRESS + 1];
262*12720SWyllys.Ingersoll@Sun.COM 
263*12720SWyllys.Ingersoll@Sun.COM     /**
264*12720SWyllys.Ingersoll@Sun.COM      *  Enabled status for the KMA, 1 for enabled, 0 if disabled.
265*12720SWyllys.Ingersoll@Sun.COM      */
266*12720SWyllys.Ingersoll@Sun.COM     int         m_iEnabled;
267*12720SWyllys.Ingersoll@Sun.COM 
268*12720SWyllys.Ingersoll@Sun.COM     /**
269*12720SWyllys.Ingersoll@Sun.COM      *   Unused at present but may be used for reporting a KMAs load to be used
270*12720SWyllys.Ingersoll@Sun.COM      *   as a load balancing heuristic.
271*12720SWyllys.Ingersoll@Sun.COM      */
272*12720SWyllys.Ingersoll@Sun.COM     Long64      m_lLoad;
273*12720SWyllys.Ingersoll@Sun.COM 
274*12720SWyllys.Ingersoll@Sun.COM     /**
275*12720SWyllys.Ingersoll@Sun.COM      *  A boolean indicating the current response status of a KMA on the network.
276*12720SWyllys.Ingersoll@Sun.COM      *  A non-responding KMA may be either down or unreachable due to the network.
277*12720SWyllys.Ingersoll@Sun.COM      */
278*12720SWyllys.Ingersoll@Sun.COM     int         m_iResponding;
279*12720SWyllys.Ingersoll@Sun.COM 
280*12720SWyllys.Ingersoll@Sun.COM     /**
281*12720SWyllys.Ingersoll@Sun.COM      *  The KMA's version level.
282*12720SWyllys.Ingersoll@Sun.COM      */
283*12720SWyllys.Ingersoll@Sun.COM     utf8char    m_sKMAVersion[KMS_MAX_VERSION_LENGTH+1];
284*12720SWyllys.Ingersoll@Sun.COM 
285*12720SWyllys.Ingersoll@Sun.COM     /**
286*12720SWyllys.Ingersoll@Sun.COM      *  KMA lock status as provided by KMS Discover Cluster service. Defaults
287*12720SWyllys.Ingersoll@Sun.COM      *  to false for KMAs earlier than KMS 2.3 where it was first introduced.
288*12720SWyllys.Ingersoll@Sun.COM      */
289*12720SWyllys.Ingersoll@Sun.COM     int m_iKMALocked;
290*12720SWyllys.Ingersoll@Sun.COM };
291*12720SWyllys.Ingersoll@Sun.COM 
292*12720SWyllys.Ingersoll@Sun.COM 
293*12720SWyllys.Ingersoll@Sun.COM /**
294*12720SWyllys.Ingersoll@Sun.COM  * the profile for an agent.  The profile contains sections that are persisted
295*12720SWyllys.Ingersoll@Sun.COM  * and fields that are volatile.  See KMSAgentStorage.h for interfaces to load/store
296*12720SWyllys.Ingersoll@Sun.COM  * the persistent sections.
297*12720SWyllys.Ingersoll@Sun.COM  * <p><b>Note</b> that members of this struct should
298*12720SWyllys.Ingersoll@Sun.COM  * not be accessed directly by users of this library.
299*12720SWyllys.Ingersoll@Sun.COM  */
300*12720SWyllys.Ingersoll@Sun.COM 
301*12720SWyllys.Ingersoll@Sun.COM /** \struct KMSClientProfile
302*12720SWyllys.Ingersoll@Sun.COM  *   the properties comprising the profile, some of which must be persisted.
303*12720SWyllys.Ingersoll@Sun.COM  */
304*12720SWyllys.Ingersoll@Sun.COM typedef struct KMSClientProfile_s
305*12720SWyllys.Ingersoll@Sun.COM {
306*12720SWyllys.Ingersoll@Sun.COM     /**
307*12720SWyllys.Ingersoll@Sun.COM      *  the version of the KMS Agent Library
308*12720SWyllys.Ingersoll@Sun.COM      */
309*12720SWyllys.Ingersoll@Sun.COM     int m_iVersion;
310*12720SWyllys.Ingersoll@Sun.COM 
311*12720SWyllys.Ingersoll@Sun.COM     /**
312*12720SWyllys.Ingersoll@Sun.COM     * Profile Name
313*12720SWyllys.Ingersoll@Sun.COM     */
314*12720SWyllys.Ingersoll@Sun.COM     utf8char m_wsProfileName[KMS_MAX_ENTITY_ID + 1];
315*12720SWyllys.Ingersoll@Sun.COM 
316*12720SWyllys.Ingersoll@Sun.COM     /**
317*12720SWyllys.Ingersoll@Sun.COM      *  Subject Name
318*12720SWyllys.Ingersoll@Sun.COM      */
319*12720SWyllys.Ingersoll@Sun.COM     utf8char m_wsEntityID[KMS_MAX_ENTITY_ID + 1];
320*12720SWyllys.Ingersoll@Sun.COM 
321*12720SWyllys.Ingersoll@Sun.COM     /**
322*12720SWyllys.Ingersoll@Sun.COM      * Appliance Address used for enrollment and discovery
323*12720SWyllys.Ingersoll@Sun.COM      */
324*12720SWyllys.Ingersoll@Sun.COM     utf8char m_wsApplianceAddress[KMS_MAX_NETWORK_ADDRESS + 1];
325*12720SWyllys.Ingersoll@Sun.COM 
326*12720SWyllys.Ingersoll@Sun.COM     /**
327*12720SWyllys.Ingersoll@Sun.COM      *  KMS CA service port
328*12720SWyllys.Ingersoll@Sun.COM      */
329*12720SWyllys.Ingersoll@Sun.COM     int m_iPortForCAService;
330*12720SWyllys.Ingersoll@Sun.COM     /**
331*12720SWyllys.Ingersoll@Sun.COM      *  KMS Certificate service port
332*12720SWyllys.Ingersoll@Sun.COM      */
333*12720SWyllys.Ingersoll@Sun.COM     int m_iPortForCertificateService;
334*12720SWyllys.Ingersoll@Sun.COM 
335*12720SWyllys.Ingersoll@Sun.COM     /**
336*12720SWyllys.Ingersoll@Sun.COM      *  KMS Agent service port
337*12720SWyllys.Ingersoll@Sun.COM      */
338*12720SWyllys.Ingersoll@Sun.COM     int m_iPortForAgentService;
339*12720SWyllys.Ingersoll@Sun.COM 
340*12720SWyllys.Ingersoll@Sun.COM     /**
341*12720SWyllys.Ingersoll@Sun.COM      *  KMS Discovery service port
342*12720SWyllys.Ingersoll@Sun.COM      */
343*12720SWyllys.Ingersoll@Sun.COM     int m_iPortForDiscoveryService;
344*12720SWyllys.Ingersoll@Sun.COM 
345*12720SWyllys.Ingersoll@Sun.COM     /**
346*12720SWyllys.Ingersoll@Sun.COM      *  timeout in seconds before failover to alternate KMS in cluster
347*12720SWyllys.Ingersoll@Sun.COM      */
348*12720SWyllys.Ingersoll@Sun.COM     int m_iTransactionTimeout;
349*12720SWyllys.Ingersoll@Sun.COM 
350*12720SWyllys.Ingersoll@Sun.COM     /**
351*12720SWyllys.Ingersoll@Sun.COM      *  the number of times failover will be attempted
352*12720SWyllys.Ingersoll@Sun.COM      */
353*12720SWyllys.Ingersoll@Sun.COM     int m_iFailoverLimit;
354*12720SWyllys.Ingersoll@Sun.COM 
355*12720SWyllys.Ingersoll@Sun.COM     /**
356*12720SWyllys.Ingersoll@Sun.COM      *  the number of times the current transaction has failed over
357*12720SWyllys.Ingersoll@Sun.COM      */
358*12720SWyllys.Ingersoll@Sun.COM     int m_iFailoverAttempts;
359*12720SWyllys.Ingersoll@Sun.COM 
360*12720SWyllys.Ingersoll@Sun.COM     /**
361*12720SWyllys.Ingersoll@Sun.COM      *  TRUE when agent has enrolled and stored its certificates.
362*12720SWyllys.Ingersoll@Sun.COM      */
363*12720SWyllys.Ingersoll@Sun.COM     int m_iEnrolled;
364*12720SWyllys.Ingersoll@Sun.COM 
365*12720SWyllys.Ingersoll@Sun.COM     /**
366*12720SWyllys.Ingersoll@Sun.COM      *  The agent's passphrase after "key stretching", i.e. hashing the number of
367*12720SWyllys.Ingersoll@Sun.COM      *  times specified by the KMA during enrollment, and converted to hexadecimal.
368*12720SWyllys.Ingersoll@Sun.COM      */
369*12720SWyllys.Ingersoll@Sun.COM     char m_sHexHashedPassphrase[2*KMS_MAX_HASH_SIZE+1];
370*12720SWyllys.Ingersoll@Sun.COM 
371*12720SWyllys.Ingersoll@Sun.COM     /**
372*12720SWyllys.Ingersoll@Sun.COM      *  gSOAP runtime context.
373*12720SWyllys.Ingersoll@Sun.COM      */
374*12720SWyllys.Ingersoll@Sun.COM     void *m_pvSoap;
375*12720SWyllys.Ingersoll@Sun.COM 
376*12720SWyllys.Ingersoll@Sun.COM     /**
377*12720SWyllys.Ingersoll@Sun.COM      * gSOAP runtime context for discovery.
378*12720SWyllys.Ingersoll@Sun.COM      */
379*12720SWyllys.Ingersoll@Sun.COM     void *m_pvDiscoverySoap;
380*12720SWyllys.Ingersoll@Sun.COM 
381*12720SWyllys.Ingersoll@Sun.COM     /**
382*12720SWyllys.Ingersoll@Sun.COM      *  A lock used internally by the agent library.
383*12720SWyllys.Ingersoll@Sun.COM      */
384*12720SWyllys.Ingersoll@Sun.COM     void *m_pLock;
385*12720SWyllys.Ingersoll@Sun.COM 
386*12720SWyllys.Ingersoll@Sun.COM     /**
387*12720SWyllys.Ingersoll@Sun.COM      *  The minimum interval between automatic cluster discovery requests in seconds.
388*12720SWyllys.Ingersoll@Sun.COM      *  A value of zero seconds disables load balancing and periodic cluster
389*12720SWyllys.Ingersoll@Sun.COM      *  discovery calls.
390*12720SWyllys.Ingersoll@Sun.COM      */
391*12720SWyllys.Ingersoll@Sun.COM     int m_iClusterDiscoveryFrequency;
392*12720SWyllys.Ingersoll@Sun.COM 
393*12720SWyllys.Ingersoll@Sun.COM     /**
394*12720SWyllys.Ingersoll@Sun.COM      *  The time in seconds when the cluster discovery service was last called for the
395*12720SWyllys.Ingersoll@Sun.COM      *  current session.
396*12720SWyllys.Ingersoll@Sun.COM      */
397*12720SWyllys.Ingersoll@Sun.COM     int m_iLastClusterDiscoveryTime;
398*12720SWyllys.Ingersoll@Sun.COM 
399*12720SWyllys.Ingersoll@Sun.COM     /**
400*12720SWyllys.Ingersoll@Sun.COM      *  The Site ID assigned to the agent by the KMS administrators.
401*12720SWyllys.Ingersoll@Sun.COM      */
402*12720SWyllys.Ingersoll@Sun.COM     utf8char m_wsEntitySiteID[KMS_MAX_ENTITY_SITE_ID + 1];
403*12720SWyllys.Ingersoll@Sun.COM 
404*12720SWyllys.Ingersoll@Sun.COM     /**
405*12720SWyllys.Ingersoll@Sun.COM      *  The total number of KMA in the KMS cluster as reported by the last
406*12720SWyllys.Ingersoll@Sun.COM      *  cluster discovery.
407*12720SWyllys.Ingersoll@Sun.COM      */
408*12720SWyllys.Ingersoll@Sun.COM     int m_iClusterNum;
409*12720SWyllys.Ingersoll@Sun.COM 
410*12720SWyllys.Ingersoll@Sun.COM     /**
411*12720SWyllys.Ingersoll@Sun.COM      *  An array of the KMAs withhin the cluster.
412*12720SWyllys.Ingersoll@Sun.COM      */
413*12720SWyllys.Ingersoll@Sun.COM     KMSClusterEntry m_aCluster[KMS_MAX_CLUSTER_NUM];
414*12720SWyllys.Ingersoll@Sun.COM 
415*12720SWyllys.Ingersoll@Sun.COM     /**
416*12720SWyllys.Ingersoll@Sun.COM      *  A boolean flag for the first cluster discovery call.
417*12720SWyllys.Ingersoll@Sun.COM      */
418*12720SWyllys.Ingersoll@Sun.COM     int m_bIsClusterDiscoveryCalled;
419*12720SWyllys.Ingersoll@Sun.COM 
420*12720SWyllys.Ingersoll@Sun.COM     /**
421*12720SWyllys.Ingersoll@Sun.COM      *  A handle to the DataUnitCache used for selection of a KMA.
422*12720SWyllys.Ingersoll@Sun.COM      */
423*12720SWyllys.Ingersoll@Sun.COM     void *m_pDataUnitCache;
424*12720SWyllys.Ingersoll@Sun.COM 
425*12720SWyllys.Ingersoll@Sun.COM     /**
426*12720SWyllys.Ingersoll@Sun.COM      *  A handle to the load balancer.
427*12720SWyllys.Ingersoll@Sun.COM      */
428*12720SWyllys.Ingersoll@Sun.COM     void *m_pAgentLoadBalancer;
429*12720SWyllys.Ingersoll@Sun.COM 
430*12720SWyllys.Ingersoll@Sun.COM     /**
431*12720SWyllys.Ingersoll@Sun.COM      *  error string
432*12720SWyllys.Ingersoll@Sun.COM      */
433*12720SWyllys.Ingersoll@Sun.COM     utf8char m_wsErrorString[KMS_MAX_ERROR_STRING + 1];
434*12720SWyllys.Ingersoll@Sun.COM 
435*12720SWyllys.Ingersoll@Sun.COM     /**
436*12720SWyllys.Ingersoll@Sun.COM      *  URL to KMA service within cluster
437*12720SWyllys.Ingersoll@Sun.COM      */
438*12720SWyllys.Ingersoll@Sun.COM     char m_sURL[KMS_MAX_URL + 1];
439*12720SWyllys.Ingersoll@Sun.COM 
440*12720SWyllys.Ingersoll@Sun.COM     /**
441*12720SWyllys.Ingersoll@Sun.COM      *  The security mode specified to <code>KMSAgent_LoadProfile</code>
442*12720SWyllys.Ingersoll@Sun.COM      */
443*12720SWyllys.Ingersoll@Sun.COM     int m_eKMSmode;
444*12720SWyllys.Ingersoll@Sun.COM 
445*12720SWyllys.Ingersoll@Sun.COM #ifdef KMSUSERPKCS12
446*12720SWyllys.Ingersoll@Sun.COM     int m_iLastErrorCode;
447*12720SWyllys.Ingersoll@Sun.COM #endif
448*12720SWyllys.Ingersoll@Sun.COM } KMSClientProfile;
449*12720SWyllys.Ingersoll@Sun.COM 
450*12720SWyllys.Ingersoll@Sun.COM #ifdef __cplusplus
451*12720SWyllys.Ingersoll@Sun.COM }
452*12720SWyllys.Ingersoll@Sun.COM #endif
453*12720SWyllys.Ingersoll@Sun.COM 
454*12720SWyllys.Ingersoll@Sun.COM 
455*12720SWyllys.Ingersoll@Sun.COM #endif
456*12720SWyllys.Ingersoll@Sun.COM 
457