998 obsolete DMA driver interfaces should be removed
[illumos-gate.git] / usr / src / lib / libkmsagent / common / KMSClientProfile.h
blobe0a635e7eb30b02a397d6c04b64227dd90aa13e1
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
26 /*-------------------------------------------------------------------------*/
27 /**
28 * \file KMSClientProfile.h
30 * The KMS Client profile management API, including profile setup, CA
31 * certificate download, and Certificate retrieval
34 /*-------------------------------------------------------------------------*/
36 #ifndef KMSCLIENT_PROFILE_H
37 #define KMSCLIENT_PROFILE_H
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
43 #ifndef KMS_LONG_LONG
44 #define KMS_LONG_LONG
46 #ifdef WIN32
47 typedef __int64 Long64;
48 #else
49 typedef long long Long64;
50 #endif
53 #endif
55 #ifdef KMSUSERPKCS12
56 #define CLIENT_PK12_FILE "clientkey.p12"
57 #endif
59 /**
60 * \note UTF-8 encoding is used for the underlying SOAP RPC transactions by
61 * this API. In order to support environments lacking wchar.h
62 * traditional C strings are used instead.
63 */
64 typedef char * utf8cstr;
66 /**
67 * @see commments for utf8cstr.
69 typedef char utf8char;
71 /**
72 * KMS Agent Toolkit Version identifier
74 #define KMS_AGENT_VERSION 0x210
76 /*---------------------------------------------------------------------------
77 * Limits and sizes
78 *--------------------------------------------------------------------------*/
79 /**
80 * The maximum length of an agent name.
82 #define KMS_MAX_AGENT_NAME 64
84 /**
85 * The size of a data unit ID in bytes.
87 #define KMS_DATA_UNIT_ID_SIZE 16
89 /**
90 * The maximum lenght of a description for key group or data unit.
92 #define KMS_MAX_DESCRIPTION 64
94 /**
95 * The maximum maximum length of an external unique id.
97 #define KMS_MAX_EXTERNAL_UNIQUE_ID_SIZE 32
99 /**
100 * The maximum external tag length.
102 #define KMS_MAX_EXTERNAL_TAG 64
105 * The size of a key ID in bytes.
107 #define KMS_KEY_ID_SIZE 30
110 * The size of an AES Key Wrapping Key ID.
112 #define KMS_KWK_KEY_ID_SIZE 8
115 * The maximum size of a key in bytes.
117 #define KMS_MAX_KEY_SIZE 32
120 * The maximum size of an wrapped key(RFC3394 AES Key Wrap) in bytes.
122 #define KMS_MAX_WRAPPED_KEY_SIZE KMS_MAX_KEY_SIZE+8
125 * The maximum length of a key group ID.
127 #define KMS_MAX_KEY_GROUP_ID_SIZE 64
130 * The maximum size of a key group list to be returned. This should
131 * be sufficient for agents as this is an atypical call.
133 #define KMS_MAX_LIST_KEY_GROUPS 100
136 * The maximum number of keys returned in a key list.
138 #define KMS_MAX_PAGE_SIZE 32
141 * The maximum passphrase length.
143 #define KMS_MAX_PASSPHRASE 64
146 * The maximum length of agent's name, aka ID.
148 #define KMS_MAX_ENTITY_ID 64
151 * The maximum length of an agent's sited ID.
153 #define KMS_MAX_ENTITY_SITE_ID 64
156 * The maximum length of a URL.
158 #define KMS_MAX_URL 512
160 /**
161 * The maximum length of a filter parameter field name.
163 #define KMS_MAX_FIELD_NAME 64
166 * The maximum length of a query parameter sort field value.
168 #define KMS_MAX_FIELD_VALUE 64
171 * The maximum ID length used in various types of IDs.
173 #define KMS_MAX_ID 64
176 * The maximum length of a KMA network address, either IPv4 or IPv6.
177 * Also maximum hostname length if/when hostnames are supported
179 #define KMS_MAX_NETWORK_ADDRESS 256
182 * The maximum length of a file name.
184 #define KMS_MAX_FILE_NAME 256
187 * The maximum length of error strings.
189 #define KMS_MAX_ERROR_STRING 1024
192 * the number of nodes in a KMS is variable. This constant
193 * dictates how many of the KMAs in a KMS will be saved to the
194 * profile, persisted to storage and used for load balancing and failover. See
195 * <code>KMSAgent_GetClusterInformation</code>
196 * Range: 1 .. max int, users should con
198 #ifndef KMS_MAX_CLUSTER_NUM
199 #define KMS_MAX_CLUSTER_NUM 20
200 #endif
203 * The maximum length for SHA1 hashes used in authentication.
205 #define KMS_MAX_HASH_SIZE 20
208 * The maximum length of a KMS verstion string.
210 #define KMS_MAX_VERSION_LENGTH 100
213 * The maximum length of working directory.
215 #define KMS_MAX_PATH_LENGTH 1024
218 * typedef for Key ID
220 typedef unsigned char KEY_ID [KMS_KEY_ID_SIZE];
223 * typedef for an unwrapped Key
225 typedef unsigned char KEY [KMS_MAX_KEY_SIZE];
228 * typedef for an AES wrapped key
230 typedef unsigned char WRAPPED_KEY [KMS_MAX_WRAPPED_KEY_SIZE];
233 * typedef for KMSClusterEntry struct
235 typedef struct KMSClusterEntry KMSClusterEntry;
237 /** \struct KMSClusterEntry
238 * A struct representing each Key Management Appliance discovered in the KMS cluster
240 struct KMSClusterEntry
243 * The KMA's identifier.
245 Long64 m_lApplianceID;
248 * The KMA's name.
250 utf8char m_wsApplianceAlias[KMS_MAX_ENTITY_ID + 1];
253 * The Sited ID for the KMA.
255 utf8char m_wsApplianceSiteID[KMS_MAX_ENTITY_SITE_ID + 1];
258 * A network address for the KMA that corresponds to the agent's network.
259 * KMAs are multi-homed so only an address useful to the agent is provided.
261 utf8char m_wsApplianceNetworkAddress[KMS_MAX_NETWORK_ADDRESS + 1];
264 * Enabled status for the KMA, 1 for enabled, 0 if disabled.
266 int m_iEnabled;
269 * Unused at present but may be used for reporting a KMAs load to be used
270 * as a load balancing heuristic.
272 Long64 m_lLoad;
275 * A boolean indicating the current response status of a KMA on the network.
276 * A non-responding KMA may be either down or unreachable due to the network.
278 int m_iResponding;
281 * The KMA's version level.
283 utf8char m_sKMAVersion[KMS_MAX_VERSION_LENGTH+1];
286 * KMA lock status as provided by KMS Discover Cluster service. Defaults
287 * to false for KMAs earlier than KMS 2.3 where it was first introduced.
289 int m_iKMALocked;
294 * the profile for an agent. The profile contains sections that are persisted
295 * and fields that are volatile. See KMSAgentStorage.h for interfaces to load/store
296 * the persistent sections.
297 * <p><b>Note</b> that members of this struct should
298 * not be accessed directly by users of this library.
301 /** \struct KMSClientProfile
302 * the properties comprising the profile, some of which must be persisted.
304 typedef struct KMSClientProfile_s
307 * the version of the KMS Agent Library
309 int m_iVersion;
312 * Profile Name
314 utf8char m_wsProfileName[KMS_MAX_ENTITY_ID + 1];
317 * Subject Name
319 utf8char m_wsEntityID[KMS_MAX_ENTITY_ID + 1];
322 * Appliance Address used for enrollment and discovery
324 utf8char m_wsApplianceAddress[KMS_MAX_NETWORK_ADDRESS + 1];
327 * KMS CA service port
329 int m_iPortForCAService;
331 * KMS Certificate service port
333 int m_iPortForCertificateService;
336 * KMS Agent service port
338 int m_iPortForAgentService;
341 * KMS Discovery service port
343 int m_iPortForDiscoveryService;
346 * timeout in seconds before failover to alternate KMS in cluster
348 int m_iTransactionTimeout;
351 * the number of times failover will be attempted
353 int m_iFailoverLimit;
356 * the number of times the current transaction has failed over
358 int m_iFailoverAttempts;
361 * TRUE when agent has enrolled and stored its certificates.
363 int m_iEnrolled;
366 * The agent's passphrase after "key stretching", i.e. hashing the number of
367 * times specified by the KMA during enrollment, and converted to hexadecimal.
369 char m_sHexHashedPassphrase[2*KMS_MAX_HASH_SIZE+1];
372 * gSOAP runtime context.
374 void *m_pvSoap;
377 * gSOAP runtime context for discovery.
379 void *m_pvDiscoverySoap;
382 * A lock used internally by the agent library.
384 void *m_pLock;
386 /**
387 * The minimum interval between automatic cluster discovery requests in seconds.
388 * A value of zero seconds disables load balancing and periodic cluster
389 * discovery calls.
391 int m_iClusterDiscoveryFrequency;
394 * The time in seconds when the cluster discovery service was last called for the
395 * current session.
397 int m_iLastClusterDiscoveryTime;
400 * The Site ID assigned to the agent by the KMS administrators.
402 utf8char m_wsEntitySiteID[KMS_MAX_ENTITY_SITE_ID + 1];
404 /**
405 * The total number of KMA in the KMS cluster as reported by the last
406 * cluster discovery.
408 int m_iClusterNum;
411 * An array of the KMAs withhin the cluster.
413 KMSClusterEntry m_aCluster[KMS_MAX_CLUSTER_NUM];
416 * A boolean flag for the first cluster discovery call.
418 int m_bIsClusterDiscoveryCalled;
421 * A handle to the DataUnitCache used for selection of a KMA.
423 void *m_pDataUnitCache;
426 * A handle to the load balancer.
428 void *m_pAgentLoadBalancer;
431 * error string
433 utf8char m_wsErrorString[KMS_MAX_ERROR_STRING + 1];
436 * URL to KMA service within cluster
438 char m_sURL[KMS_MAX_URL + 1];
440 /**
441 * The security mode specified to <code>KMSAgent_LoadProfile</code>
443 int m_eKMSmode;
445 #ifdef KMSUSERPKCS12
446 int m_iLastErrorCode;
447 #endif
448 } KMSClientProfile;
450 #ifdef __cplusplus
452 #endif
455 #endif