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) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 24*12720SWyllys.Ingersoll@Sun.COM */ 25*12720SWyllys.Ingersoll@Sun.COM 26*12720SWyllys.Ingersoll@Sun.COM /** @file KMSAgent.h 27*12720SWyllys.Ingersoll@Sun.COM * @defgroup EncryptionAgent Encryption Agent API 28*12720SWyllys.Ingersoll@Sun.COM * 29*12720SWyllys.Ingersoll@Sun.COM * The Agent API is used to communicate with the KMS Appliance for the 30*12720SWyllys.Ingersoll@Sun.COM * purpose of registering storage devices, obtaining device keys, and 31*12720SWyllys.Ingersoll@Sun.COM * receiving notifications of storage device events such as destruction. 32*12720SWyllys.Ingersoll@Sun.COM * 33*12720SWyllys.Ingersoll@Sun.COM */ 34*12720SWyllys.Ingersoll@Sun.COM #ifndef KMS_AGENT_H 35*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_H 36*12720SWyllys.Ingersoll@Sun.COM 37*12720SWyllys.Ingersoll@Sun.COM #include "KMSClientProfile.h" 38*12720SWyllys.Ingersoll@Sun.COM 39*12720SWyllys.Ingersoll@Sun.COM /*--------------------------------------------------------------------------- 40*12720SWyllys.Ingersoll@Sun.COM * The following ifdef block is the standard way of creating macros which 41*12720SWyllys.Ingersoll@Sun.COM * make exporting from a DLL simpler. All files within this DLL are compiled 42*12720SWyllys.Ingersoll@Sun.COM * with the KMS_AGENT_EXPORT symbol defined on the command line. this symbol 43*12720SWyllys.Ingersoll@Sun.COM * should not be defined on any project that uses this DLL. This way any 44*12720SWyllys.Ingersoll@Sun.COM * other project whose source files include this file see KMS Agent API functions 45*12720SWyllys.Ingersoll@Sun.COM * as being imported from a DLL, wheras this DLL sees symbols defined with 46*12720SWyllys.Ingersoll@Sun.COM * this macro as being exported. 47*12720SWyllys.Ingersoll@Sun.COM *--------------------------------------------------------------------------*/ 48*12720SWyllys.Ingersoll@Sun.COM #ifdef KMS_AGENT_EXPORT 49*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_API __declspec(dllexport) 50*12720SWyllys.Ingersoll@Sun.COM #else 51*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_API __declspec(dllimport) 52*12720SWyllys.Ingersoll@Sun.COM #endif 53*12720SWyllys.Ingersoll@Sun.COM 54*12720SWyllys.Ingersoll@Sun.COM #ifdef __cplusplus 55*12720SWyllys.Ingersoll@Sun.COM extern "C" { 56*12720SWyllys.Ingersoll@Sun.COM #endif 57*12720SWyllys.Ingersoll@Sun.COM 58*12720SWyllys.Ingersoll@Sun.COM /*--------------------------------------------------------------------------- 59*12720SWyllys.Ingersoll@Sun.COM * Return Codes 60*12720SWyllys.Ingersoll@Sun.COM *--------------------------------------------------------------------------*/ 61*12720SWyllys.Ingersoll@Sun.COM 62*12720SWyllys.Ingersoll@Sun.COM /** 63*12720SWyllys.Ingersoll@Sun.COM * The status type returned on API calls 64*12720SWyllys.Ingersoll@Sun.COM */ 65*12720SWyllys.Ingersoll@Sun.COM typedef int KMS_AGENT_STATUS; 66*12720SWyllys.Ingersoll@Sun.COM 67*12720SWyllys.Ingersoll@Sun.COM /** 68*12720SWyllys.Ingersoll@Sun.COM * successful status 69*12720SWyllys.Ingersoll@Sun.COM */ 70*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_OK 0 71*12720SWyllys.Ingersoll@Sun.COM 72*12720SWyllys.Ingersoll@Sun.COM /* error status values */ 73*12720SWyllys.Ingersoll@Sun.COM /** 74*12720SWyllys.Ingersoll@Sun.COM * generic error is a catch all for a wide variety of errors, see the specific 75*12720SWyllys.Ingersoll@Sun.COM * entry in the audit log for the details. In general, the client API will return 76*12720SWyllys.Ingersoll@Sun.COM * one of the specific status codes. 77*12720SWyllys.Ingersoll@Sun.COM */ 78*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_GENERIC_ERROR 100 79*12720SWyllys.Ingersoll@Sun.COM 80*12720SWyllys.Ingersoll@Sun.COM /** 81*12720SWyllys.Ingersoll@Sun.COM * insufficient memory for the agent library to complete the request 82*12720SWyllys.Ingersoll@Sun.COM */ 83*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_NO_MEMORY 102 84*12720SWyllys.Ingersoll@Sun.COM 85*12720SWyllys.Ingersoll@Sun.COM /** 86*12720SWyllys.Ingersoll@Sun.COM * parameter error, invalid input 87*12720SWyllys.Ingersoll@Sun.COM */ 88*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_INVALID_PARAMETER 103 89*12720SWyllys.Ingersoll@Sun.COM 90*12720SWyllys.Ingersoll@Sun.COM /** 91*12720SWyllys.Ingersoll@Sun.COM * an API call was made before the profile was loaded 92*12720SWyllys.Ingersoll@Sun.COM */ 93*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_PROFILE_NOT_LOADED 104 94*12720SWyllys.Ingersoll@Sun.COM 95*12720SWyllys.Ingersoll@Sun.COM /** 96*12720SWyllys.Ingersoll@Sun.COM * upon receipt of a key the callout function returned an error 97*12720SWyllys.Ingersoll@Sun.COM */ 98*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_KEY_CALLOUT_FAILURE 105 99*12720SWyllys.Ingersoll@Sun.COM 100*12720SWyllys.Ingersoll@Sun.COM /** 101*12720SWyllys.Ingersoll@Sun.COM * the specified profile failover attempts have been exceeded or no KMAs are available within the cluster 102*12720SWyllys.Ingersoll@Sun.COM */ 103*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_KMS_UNAVAILABLE 106 104*12720SWyllys.Ingersoll@Sun.COM 105*12720SWyllys.Ingersoll@Sun.COM /** 106*12720SWyllys.Ingersoll@Sun.COM * the KMS does not have any keys in the READY state, this is a KMS issue that requires attention 107*12720SWyllys.Ingersoll@Sun.COM * from a KMS administrator. 108*12720SWyllys.Ingersoll@Sun.COM */ 109*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_KMS_NO_READY_KEYS 107 110*12720SWyllys.Ingersoll@Sun.COM 111*12720SWyllys.Ingersoll@Sun.COM /** 112*12720SWyllys.Ingersoll@Sun.COM * the FIPS 140-2 known answer test (KAK) failed for AES Key wrap. 113*12720SWyllys.Ingersoll@Sun.COM */ 114*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_FIPS_KAT_AES_KEYWRAP_ERROR 108 115*12720SWyllys.Ingersoll@Sun.COM 116*12720SWyllys.Ingersoll@Sun.COM /** 117*12720SWyllys.Ingersoll@Sun.COM * #FIPS_MODE was specified on #KMSAgent_LoadProfile 118*12720SWyllys.Ingersoll@Sun.COM * but no FIPS compatible KMAs are currently 119*12720SWyllys.Ingersoll@Sun.COM * available. Also, it may be that no FIPS compatible KMAs have been 120*12720SWyllys.Ingersoll@Sun.COM * configured within the KMS. 121*12720SWyllys.Ingersoll@Sun.COM */ 122*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_NO_FIPS_KMAS_AVAILABLE 109 123*12720SWyllys.Ingersoll@Sun.COM 124*12720SWyllys.Ingersoll@Sun.COM /** 125*12720SWyllys.Ingersoll@Sun.COM * the profile was already successfully loaded and should be unloaded 126*12720SWyllys.Ingersoll@Sun.COM * before attempting to load it again 127*12720SWyllys.Ingersoll@Sun.COM */ 128*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_PROFILE_ALREADY_LOADED 110 129*12720SWyllys.Ingersoll@Sun.COM 130*12720SWyllys.Ingersoll@Sun.COM /** 131*12720SWyllys.Ingersoll@Sun.COM * the FIPS 140-2 known answer test (KAK) failed for AES ECB. 132*12720SWyllys.Ingersoll@Sun.COM */ 133*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_FIPS_KAT_AES_ECB_ERROR 111 134*12720SWyllys.Ingersoll@Sun.COM 135*12720SWyllys.Ingersoll@Sun.COM /** 136*12720SWyllys.Ingersoll@Sun.COM * the FIPS 140-2 known answer test (KAK) failed for HMAC-SHA1. 137*12720SWyllys.Ingersoll@Sun.COM */ 138*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_FIPS_KAT_HMAC_SHA1_ERROR 112 139*12720SWyllys.Ingersoll@Sun.COM 140*12720SWyllys.Ingersoll@Sun.COM /* 141*12720SWyllys.Ingersoll@Sun.COM * SOAP Sender Errors - client errors associated with a KMS SOAP service 142*12720SWyllys.Ingersoll@Sun.COM */ 143*12720SWyllys.Ingersoll@Sun.COM 144*12720SWyllys.Ingersoll@Sun.COM /** 145*12720SWyllys.Ingersoll@Sun.COM * the following conditions can result in access denied being returned by the KMSAgent Soap service: 146*12720SWyllys.Ingersoll@Sun.COM * <ul> 147*12720SWyllys.Ingersoll@Sun.COM * <li>Agent is not enabled on the KMS 148*12720SWyllys.Ingersoll@Sun.COM * <li>Invalid DataUnitID or DataUnit does not exist 149*12720SWyllys.Ingersoll@Sun.COM * <li>Invalid ExternalUniqueID or DataUnit does not exist with specified ID 150*12720SWyllys.Ingersoll@Sun.COM * <li>Invalid ExternalTag 151*12720SWyllys.Ingersoll@Sun.COM * <li>Invalid KeyID 152*12720SWyllys.Ingersoll@Sun.COM * <li>Invalid KeyGroup or KeyGroup does not exist 153*12720SWyllys.Ingersoll@Sun.COM * <li>The Agent ID is not recognized as an agent by the KMS, i.e. the agent may not exist or the 154*12720SWyllys.Ingersoll@Sun.COM * ID represents another kind of entity. 155*12720SWyllys.Ingersoll@Sun.COM * <li>No KeyGroup specified and the Agent is not configured to have a default KeyGroup 156*12720SWyllys.Ingersoll@Sun.COM * <li>Agent does not have access to the specified KeyGroup 157*12720SWyllys.Ingersoll@Sun.COM * </ul> 158*12720SWyllys.Ingersoll@Sun.COM * to prevent leakage of information the specific details for access being denied are not 159*12720SWyllys.Ingersoll@Sun.COM * disclosed. Audit log entries at the KMS can be used to determine specific reasons for 160*12720SWyllys.Ingersoll@Sun.COM * access being denied. 161*12720SWyllys.Ingersoll@Sun.COM */ 162*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_ACCESS_DENIED 200 163*12720SWyllys.Ingersoll@Sun.COM 164*12720SWyllys.Ingersoll@Sun.COM /** 165*12720SWyllys.Ingersoll@Sun.COM * This error status is only returned when received from the KMS and the transaction 166*12720SWyllys.Ingersoll@Sun.COM * timeout has been exceeded. 167*12720SWyllys.Ingersoll@Sun.COM */ 168*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_SERVER_BUSY 201 169*12720SWyllys.Ingersoll@Sun.COM 170*12720SWyllys.Ingersoll@Sun.COM /** 171*12720SWyllys.Ingersoll@Sun.COM * a data unit already exists with the specified external unique identifier 172*12720SWyllys.Ingersoll@Sun.COM */ 173*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_EXTERNAL_UNIQUE_ID_EXISTS 202 174*12720SWyllys.Ingersoll@Sun.COM 175*12720SWyllys.Ingersoll@Sun.COM /** 176*12720SWyllys.Ingersoll@Sun.COM * The external unique ID specified was found to exist but the corresponding 177*12720SWyllys.Ingersoll@Sun.COM * DataUnitID did not exist. 178*12720SWyllys.Ingersoll@Sun.COM */ 179*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_DATA_UNIT_ID_NOT_FOUND_EXTERNAL_ID_EXISTS 203 180*12720SWyllys.Ingersoll@Sun.COM 181*12720SWyllys.Ingersoll@Sun.COM 182*12720SWyllys.Ingersoll@Sun.COM /** 183*12720SWyllys.Ingersoll@Sun.COM * The specified key has been destroyed or is unknown to the KMS 184*12720SWyllys.Ingersoll@Sun.COM */ 185*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_KEY_DOES_NOT_EXIST 204 186*12720SWyllys.Ingersoll@Sun.COM 187*12720SWyllys.Ingersoll@Sun.COM /** 188*12720SWyllys.Ingersoll@Sun.COM * The requested key has been destroyed. 189*12720SWyllys.Ingersoll@Sun.COM */ 190*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_STATUS_KEY_DESTROYED 205 191*12720SWyllys.Ingersoll@Sun.COM 192*12720SWyllys.Ingersoll@Sun.COM /** 193*12720SWyllys.Ingersoll@Sun.COM * The key received from a KMA encountered an error during AES Key Unwrapping 194*12720SWyllys.Ingersoll@Sun.COM */ 195*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_AES_KEY_UNWRAP_ERROR 206 196*12720SWyllys.Ingersoll@Sun.COM 197*12720SWyllys.Ingersoll@Sun.COM /** 198*12720SWyllys.Ingersoll@Sun.COM * An error occurred during establishment of an AES Key-Encryption Key 199*12720SWyllys.Ingersoll@Sun.COM */ 200*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_AES_KEY_WRAP_SETUP_ERROR 207 201*12720SWyllys.Ingersoll@Sun.COM 202*12720SWyllys.Ingersoll@Sun.COM /* 203*12720SWyllys.Ingersoll@Sun.COM * Failed to decrypt the client private key data file due to incorrect PIN 204*12720SWyllys.Ingersoll@Sun.COM */ 205*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_LOCAL_AUTH_FAILURE 208 206*12720SWyllys.Ingersoll@Sun.COM 207*12720SWyllys.Ingersoll@Sun.COM /** 208*12720SWyllys.Ingersoll@Sun.COM * supported key types 209*12720SWyllys.Ingersoll@Sun.COM */ 210*12720SWyllys.Ingersoll@Sun.COM enum KMS_KEY_TYPE 211*12720SWyllys.Ingersoll@Sun.COM { 212*12720SWyllys.Ingersoll@Sun.COM /** 213*12720SWyllys.Ingersoll@Sun.COM * AES 256 key type 214*12720SWyllys.Ingersoll@Sun.COM */ 215*12720SWyllys.Ingersoll@Sun.COM KMS_KEY_TYPE_AES_256 216*12720SWyllys.Ingersoll@Sun.COM }; 217*12720SWyllys.Ingersoll@Sun.COM 218*12720SWyllys.Ingersoll@Sun.COM /** 219*12720SWyllys.Ingersoll@Sun.COM * This enumerator type defines the various Key States. 220*12720SWyllys.Ingersoll@Sun.COM */ 221*12720SWyllys.Ingersoll@Sun.COM enum KMS_AGENT_KEY_STATE 222*12720SWyllys.Ingersoll@Sun.COM { 223*12720SWyllys.Ingersoll@Sun.COM KMS_KEY_STATE_GENERATED = 0, 224*12720SWyllys.Ingersoll@Sun.COM KMS_KEY_STATE_READY, 225*12720SWyllys.Ingersoll@Sun.COM 226*12720SWyllys.Ingersoll@Sun.COM /** 227*12720SWyllys.Ingersoll@Sun.COM * A key in this state can be used for both encryption and decryption. 228*12720SWyllys.Ingersoll@Sun.COM * A key is placed into this state when it is assigned. The assignment is done when an encryption agent requests a new key be created. 229*12720SWyllys.Ingersoll@Sun.COM */ 230*12720SWyllys.Ingersoll@Sun.COM KMS_KEY_STATE_ACTIVE_PROTECT_AND_PROCESS, 231*12720SWyllys.Ingersoll@Sun.COM 232*12720SWyllys.Ingersoll@Sun.COM /** 233*12720SWyllys.Ingersoll@Sun.COM * A key in this state can be used for decryption but not encryption. When an agent determines that none of the keys available to 234*12720SWyllys.Ingersoll@Sun.COM * it (e.g., for a specific data unit that is being read or written) are in the protect-and-process state, it should create a new key. 235*12720SWyllys.Ingersoll@Sun.COM * Keys transition from protect-and-process to process only when the encryption period for the key expires. 236*12720SWyllys.Ingersoll@Sun.COM */ 237*12720SWyllys.Ingersoll@Sun.COM KMS_KEY_STATE_ACTIVE_PROCESS_ONLY, 238*12720SWyllys.Ingersoll@Sun.COM 239*12720SWyllys.Ingersoll@Sun.COM /** 240*12720SWyllys.Ingersoll@Sun.COM * The key has passed its cryptoperiod but may still be needed to process (decrypt) information. Auditable events are generated 241*12720SWyllys.Ingersoll@Sun.COM * when keys in this state are provided to the agent. 242*12720SWyllys.Ingersoll@Sun.COM */ 243*12720SWyllys.Ingersoll@Sun.COM KMS_KEY_STATE_DEACTIVATED, 244*12720SWyllys.Ingersoll@Sun.COM 245*12720SWyllys.Ingersoll@Sun.COM /** 246*12720SWyllys.Ingersoll@Sun.COM * Keys are compromised when they are released to or discovered by an unauthorized entity. 247*12720SWyllys.Ingersoll@Sun.COM * Compromised keys should not be used to protect information, but may be used to process information. 248*12720SWyllys.Ingersoll@Sun.COM * Auditable events are generated 249*12720SWyllys.Ingersoll@Sun.COM * when keys in this state are provided to the agent. 250*12720SWyllys.Ingersoll@Sun.COM */ 251*12720SWyllys.Ingersoll@Sun.COM KMS_KEY_STATE_COMPROMISED, 252*12720SWyllys.Ingersoll@Sun.COM 253*12720SWyllys.Ingersoll@Sun.COM KMS_KEY_STATE_DESTROYED_INCOMPLETE, 254*12720SWyllys.Ingersoll@Sun.COM KMS_KEY_STATE_DESTROYED_COMPLETE, 255*12720SWyllys.Ingersoll@Sun.COM KMS_KEY_STATE_DESTROYED_COMPROMISED_INCOMPLETE, 256*12720SWyllys.Ingersoll@Sun.COM KMS_KEY_STATE_DESTROYED_COMPROMISED_COMPLETE 257*12720SWyllys.Ingersoll@Sun.COM 258*12720SWyllys.Ingersoll@Sun.COM }; 259*12720SWyllys.Ingersoll@Sun.COM 260*12720SWyllys.Ingersoll@Sun.COM /*--------------------------------------------------------------------------- 261*12720SWyllys.Ingersoll@Sun.COM * Data Unit State 262*12720SWyllys.Ingersoll@Sun.COM *--------------------------------------------------------------------------*/ 263*12720SWyllys.Ingersoll@Sun.COM 264*12720SWyllys.Ingersoll@Sun.COM /** 265*12720SWyllys.Ingersoll@Sun.COM * this enumeration defines the DataUnit states 266*12720SWyllys.Ingersoll@Sun.COM */ 267*12720SWyllys.Ingersoll@Sun.COM enum KMS_AGENT_DATA_UNIT_STATE 268*12720SWyllys.Ingersoll@Sun.COM { 269*12720SWyllys.Ingersoll@Sun.COM /** 270*12720SWyllys.Ingersoll@Sun.COM * When a data unit has been created, but has not yet had any keys created it will be in "no key" state. 271*12720SWyllys.Ingersoll@Sun.COM * This should be a short, transient condition that will be exited as soon as a key has been created. 272*12720SWyllys.Ingersoll@Sun.COM */ 273*12720SWyllys.Ingersoll@Sun.COM KMS_DATA_UNIT_STATE_NO_KEY = 0, 274*12720SWyllys.Ingersoll@Sun.COM 275*12720SWyllys.Ingersoll@Sun.COM /** 276*12720SWyllys.Ingersoll@Sun.COM * Normal is a substate of readable. In this state, a data unit has at least one protect-and-process state key that can be used to encrypt data. 277*12720SWyllys.Ingersoll@Sun.COM * The data unit is therefore writable. 278*12720SWyllys.Ingersoll@Sun.COM */ 279*12720SWyllys.Ingersoll@Sun.COM KMS_DATA_UNIT_STATE_READABLE_NORMAL, 280*12720SWyllys.Ingersoll@Sun.COM 281*12720SWyllys.Ingersoll@Sun.COM /** 282*12720SWyllys.Ingersoll@Sun.COM * Needs rekey is a substate of readable. In this state, the data unit has no protect-and-process keys. 283*12720SWyllys.Ingersoll@Sun.COM * Data should not be encrypted and written to the data unit unless the data unit is rekeyed and a new, active key is assigned. 284*12720SWyllys.Ingersoll@Sun.COM * Its the responsibility of the agent to avoid using a key that is not in protect-and-process state for encryption. 285*12720SWyllys.Ingersoll@Sun.COM * The data unit may have keys that are in process only, deactivated, or compromised state. Any of these keys can be used for decryption. 286*12720SWyllys.Ingersoll@Sun.COM */ 287*12720SWyllys.Ingersoll@Sun.COM KMS_DATA_UNIT_STATE_READABLE_NEEDS_REKEY, 288*12720SWyllys.Ingersoll@Sun.COM 289*12720SWyllys.Ingersoll@Sun.COM /** 290*12720SWyllys.Ingersoll@Sun.COM * When all of the keys for a data unit are destroyed, the data unit is shredded. The data unit cannot be read or written. 291*12720SWyllys.Ingersoll@Sun.COM * However, a new key can be created for the data unit. This will return the data unit to normal state, allowing it to be read and written. 292*12720SWyllys.Ingersoll@Sun.COM */ 293*12720SWyllys.Ingersoll@Sun.COM KMS_DATA_UNIT_STATE_SHREDDED 294*12720SWyllys.Ingersoll@Sun.COM }; 295*12720SWyllys.Ingersoll@Sun.COM 296*12720SWyllys.Ingersoll@Sun.COM /** 297*12720SWyllys.Ingersoll@Sun.COM * This enumeration type defines Audit Log Retention values 298*12720SWyllys.Ingersoll@Sun.COM */ 299*12720SWyllys.Ingersoll@Sun.COM enum KMS_AUDIT_LOG_RETENTION 300*12720SWyllys.Ingersoll@Sun.COM { 301*12720SWyllys.Ingersoll@Sun.COM /** 302*12720SWyllys.Ingersoll@Sun.COM * specifies that an audit log entry should have long term retention 303*12720SWyllys.Ingersoll@Sun.COM */ 304*12720SWyllys.Ingersoll@Sun.COM KMS_AUDIT_LOG_LONG_TERM_RETENTION = 0, 305*12720SWyllys.Ingersoll@Sun.COM /** 306*12720SWyllys.Ingersoll@Sun.COM * specifies that an audit log entry should have medium term retention 307*12720SWyllys.Ingersoll@Sun.COM */ 308*12720SWyllys.Ingersoll@Sun.COM KMS_AUDIT_LOG_MEDIUM_TERM_RETENTION, 309*12720SWyllys.Ingersoll@Sun.COM /** 310*12720SWyllys.Ingersoll@Sun.COM * specifies that an audit log entry should have short term retention 311*12720SWyllys.Ingersoll@Sun.COM */ 312*12720SWyllys.Ingersoll@Sun.COM KMS_AUDIT_LOG_SHORT_TERM_RETENTION 313*12720SWyllys.Ingersoll@Sun.COM }; 314*12720SWyllys.Ingersoll@Sun.COM 315*12720SWyllys.Ingersoll@Sun.COM /** 316*12720SWyllys.Ingersoll@Sun.COM * This enumeration type defines Audit Log Condition values 317*12720SWyllys.Ingersoll@Sun.COM */ 318*12720SWyllys.Ingersoll@Sun.COM enum KMS_AUDIT_LOG_CONDITION 319*12720SWyllys.Ingersoll@Sun.COM { 320*12720SWyllys.Ingersoll@Sun.COM /** 321*12720SWyllys.Ingersoll@Sun.COM * specifies that an audit log entry should should indicate a success condition 322*12720SWyllys.Ingersoll@Sun.COM */ 323*12720SWyllys.Ingersoll@Sun.COM KMS_AUDIT_LOG_SUCCESS_CONDITION = 0, 324*12720SWyllys.Ingersoll@Sun.COM 325*12720SWyllys.Ingersoll@Sun.COM /** 326*12720SWyllys.Ingersoll@Sun.COM * specifies that an audit log entry should should indicate an error condition 327*12720SWyllys.Ingersoll@Sun.COM */ 328*12720SWyllys.Ingersoll@Sun.COM KMS_AUDIT_LOG_ERROR_CONDITION, 329*12720SWyllys.Ingersoll@Sun.COM 330*12720SWyllys.Ingersoll@Sun.COM /** 331*12720SWyllys.Ingersoll@Sun.COM * specifies that an audit log entry should should indicate a warning condition 332*12720SWyllys.Ingersoll@Sun.COM */ 333*12720SWyllys.Ingersoll@Sun.COM KMS_AUDIT_LOG_WARNING_CONDITION 334*12720SWyllys.Ingersoll@Sun.COM }; 335*12720SWyllys.Ingersoll@Sun.COM 336*12720SWyllys.Ingersoll@Sun.COM /** 337*12720SWyllys.Ingersoll@Sun.COM * supported security modes 338*12720SWyllys.Ingersoll@Sun.COM */ 339*12720SWyllys.Ingersoll@Sun.COM enum KMS_SECURITY_MODE 340*12720SWyllys.Ingersoll@Sun.COM { 341*12720SWyllys.Ingersoll@Sun.COM /** 342*12720SWyllys.Ingersoll@Sun.COM * agent will work with any level of KMA 343*12720SWyllys.Ingersoll@Sun.COM */ 344*12720SWyllys.Ingersoll@Sun.COM DEFAULT_MODE = 0, 345*12720SWyllys.Ingersoll@Sun.COM 346*12720SWyllys.Ingersoll@Sun.COM /** 347*12720SWyllys.Ingersoll@Sun.COM * agent will only communicate with KMAs supporting FIPS 140-2 so that 348*12720SWyllys.Ingersoll@Sun.COM * keys are encrypted at the KMA using AES Key Wrap. 349*12720SWyllys.Ingersoll@Sun.COM */ 350*12720SWyllys.Ingersoll@Sun.COM FIPS_MODE 351*12720SWyllys.Ingersoll@Sun.COM }; 352*12720SWyllys.Ingersoll@Sun.COM 353*12720SWyllys.Ingersoll@Sun.COM /*--------------------------------------------------------------------------- 354*12720SWyllys.Ingersoll@Sun.COM * API Input/Output Data Structures 355*12720SWyllys.Ingersoll@Sun.COM *--------------------------------------------------------------------------*/ 356*12720SWyllys.Ingersoll@Sun.COM /** 357*12720SWyllys.Ingersoll@Sun.COM * typedef for descriptions used in various places within the API 358*12720SWyllys.Ingersoll@Sun.COM */ 359*12720SWyllys.Ingersoll@Sun.COM typedef utf8char DESCRIPTION [KMS_MAX_DESCRIPTION+1]; 360*12720SWyllys.Ingersoll@Sun.COM 361*12720SWyllys.Ingersoll@Sun.COM /** 362*12720SWyllys.Ingersoll@Sun.COM * typedef for key group ID 363*12720SWyllys.Ingersoll@Sun.COM */ 364*12720SWyllys.Ingersoll@Sun.COM typedef utf8char KEY_GROUP_ID[KMS_MAX_ID+1]; 365*12720SWyllys.Ingersoll@Sun.COM 366*12720SWyllys.Ingersoll@Sun.COM /** 367*12720SWyllys.Ingersoll@Sun.COM * typedef for the Key Group struct 368*12720SWyllys.Ingersoll@Sun.COM */ 369*12720SWyllys.Ingersoll@Sun.COM typedef struct KMSAgent_KeyGroup KMSAgent_KeyGroup; 370*12720SWyllys.Ingersoll@Sun.COM 371*12720SWyllys.Ingersoll@Sun.COM /** \struct KMSAgent_KeyGroup 372*12720SWyllys.Ingersoll@Sun.COM * a Key Group with its ID and description 373*12720SWyllys.Ingersoll@Sun.COM */ 374*12720SWyllys.Ingersoll@Sun.COM struct KMSAgent_KeyGroup 375*12720SWyllys.Ingersoll@Sun.COM { 376*12720SWyllys.Ingersoll@Sun.COM /** 377*12720SWyllys.Ingersoll@Sun.COM * the unique ID of the KeyGroup 378*12720SWyllys.Ingersoll@Sun.COM */ 379*12720SWyllys.Ingersoll@Sun.COM KEY_GROUP_ID m_acKeyGroupID; 380*12720SWyllys.Ingersoll@Sun.COM 381*12720SWyllys.Ingersoll@Sun.COM /** 382*12720SWyllys.Ingersoll@Sun.COM * the description of the KeyGroup 383*12720SWyllys.Ingersoll@Sun.COM */ 384*12720SWyllys.Ingersoll@Sun.COM DESCRIPTION m_acDescription; 385*12720SWyllys.Ingersoll@Sun.COM }; 386*12720SWyllys.Ingersoll@Sun.COM 387*12720SWyllys.Ingersoll@Sun.COM /** 388*12720SWyllys.Ingersoll@Sun.COM * An array of Key Groups 389*12720SWyllys.Ingersoll@Sun.COM */ 390*12720SWyllys.Ingersoll@Sun.COM typedef struct KMSAgent_ArrayOfKeyGroups KMSAgent_ArrayOfKeyGroups; 391*12720SWyllys.Ingersoll@Sun.COM 392*12720SWyllys.Ingersoll@Sun.COM /** \struct KMSAgent_ArrayOfKeyGroups 393*12720SWyllys.Ingersoll@Sun.COM * An array of Key Groups 394*12720SWyllys.Ingersoll@Sun.COM */ 395*12720SWyllys.Ingersoll@Sun.COM struct KMSAgent_ArrayOfKeyGroups 396*12720SWyllys.Ingersoll@Sun.COM { 397*12720SWyllys.Ingersoll@Sun.COM /** 398*12720SWyllys.Ingersoll@Sun.COM * pointer to an array of Key Groups 399*12720SWyllys.Ingersoll@Sun.COM */ 400*12720SWyllys.Ingersoll@Sun.COM KMSAgent_KeyGroup* m_pKeyGroups; 401*12720SWyllys.Ingersoll@Sun.COM 402*12720SWyllys.Ingersoll@Sun.COM /** 403*12720SWyllys.Ingersoll@Sun.COM * the number of Key Groups in the array 404*12720SWyllys.Ingersoll@Sun.COM */ 405*12720SWyllys.Ingersoll@Sun.COM int m_iSize; 406*12720SWyllys.Ingersoll@Sun.COM }; 407*12720SWyllys.Ingersoll@Sun.COM 408*12720SWyllys.Ingersoll@Sun.COM 409*12720SWyllys.Ingersoll@Sun.COM /** 410*12720SWyllys.Ingersoll@Sun.COM * typedef for a Key struct 411*12720SWyllys.Ingersoll@Sun.COM */ 412*12720SWyllys.Ingersoll@Sun.COM typedef struct KMSAgent_Key KMSAgent_Key; 413*12720SWyllys.Ingersoll@Sun.COM 414*12720SWyllys.Ingersoll@Sun.COM /** \struct KMSAgent_Key 415*12720SWyllys.Ingersoll@Sun.COM * key and its associated properites: KeyID, state, type, lenth, KeyGroup and the Key value 416*12720SWyllys.Ingersoll@Sun.COM */ 417*12720SWyllys.Ingersoll@Sun.COM struct KMSAgent_Key 418*12720SWyllys.Ingersoll@Sun.COM { 419*12720SWyllys.Ingersoll@Sun.COM /** 420*12720SWyllys.Ingersoll@Sun.COM * the unique ID of the key 421*12720SWyllys.Ingersoll@Sun.COM */ 422*12720SWyllys.Ingersoll@Sun.COM KEY_ID m_acKeyID; 423*12720SWyllys.Ingersoll@Sun.COM 424*12720SWyllys.Ingersoll@Sun.COM /** 425*12720SWyllys.Ingersoll@Sun.COM * the state of the Key 426*12720SWyllys.Ingersoll@Sun.COM */ 427*12720SWyllys.Ingersoll@Sun.COM enum KMS_AGENT_KEY_STATE m_iKeyState; 428*12720SWyllys.Ingersoll@Sun.COM 429*12720SWyllys.Ingersoll@Sun.COM /** 430*12720SWyllys.Ingersoll@Sun.COM * the type of the key, e.g. AES_256 431*12720SWyllys.Ingersoll@Sun.COM */ 432*12720SWyllys.Ingersoll@Sun.COM enum KMS_KEY_TYPE m_iKeyType; 433*12720SWyllys.Ingersoll@Sun.COM 434*12720SWyllys.Ingersoll@Sun.COM /** 435*12720SWyllys.Ingersoll@Sun.COM * the unique ID of the KeyGroup 436*12720SWyllys.Ingersoll@Sun.COM */ 437*12720SWyllys.Ingersoll@Sun.COM KEY_GROUP_ID m_acKeyGroupID; 438*12720SWyllys.Ingersoll@Sun.COM 439*12720SWyllys.Ingersoll@Sun.COM /** 440*12720SWyllys.Ingersoll@Sun.COM * the key in plaintext. 441*12720SWyllys.Ingersoll@Sun.COM */ 442*12720SWyllys.Ingersoll@Sun.COM KEY m_acKey; 443*12720SWyllys.Ingersoll@Sun.COM 444*12720SWyllys.Ingersoll@Sun.COM /** 445*12720SWyllys.Ingersoll@Sun.COM * length of #m_acKey 446*12720SWyllys.Ingersoll@Sun.COM */ 447*12720SWyllys.Ingersoll@Sun.COM int m_iKeyLength; 448*12720SWyllys.Ingersoll@Sun.COM }; 449*12720SWyllys.Ingersoll@Sun.COM 450*12720SWyllys.Ingersoll@Sun.COM /** 451*12720SWyllys.Ingersoll@Sun.COM * typedef for the External Unique ID 452*12720SWyllys.Ingersoll@Sun.COM */ 453*12720SWyllys.Ingersoll@Sun.COM typedef unsigned char EXTERNAL_UNIQUE_ID [KMS_MAX_EXTERNAL_UNIQUE_ID_SIZE]; 454*12720SWyllys.Ingersoll@Sun.COM 455*12720SWyllys.Ingersoll@Sun.COM /** 456*12720SWyllys.Ingersoll@Sun.COM * typedef for the Data Unit ID 457*12720SWyllys.Ingersoll@Sun.COM */ 458*12720SWyllys.Ingersoll@Sun.COM typedef unsigned char DATA_UNIT_ID [KMS_DATA_UNIT_ID_SIZE]; 459*12720SWyllys.Ingersoll@Sun.COM 460*12720SWyllys.Ingersoll@Sun.COM /** 461*12720SWyllys.Ingersoll@Sun.COM * typedef for the External Tag 462*12720SWyllys.Ingersoll@Sun.COM */ 463*12720SWyllys.Ingersoll@Sun.COM typedef utf8char EXTERNAL_TAG [KMS_MAX_EXTERNAL_TAG+1]; 464*12720SWyllys.Ingersoll@Sun.COM 465*12720SWyllys.Ingersoll@Sun.COM /** 466*12720SWyllys.Ingersoll@Sun.COM * typedef for aData Unit structure. 467*12720SWyllys.Ingersoll@Sun.COM */ 468*12720SWyllys.Ingersoll@Sun.COM typedef struct KMSAgent_DataUnit KMSAgent_DataUnit; 469*12720SWyllys.Ingersoll@Sun.COM 470*12720SWyllys.Ingersoll@Sun.COM /** \struct KMSAgent_DataUnit 471*12720SWyllys.Ingersoll@Sun.COM * struct for a DataUnit and its associated properties: DataUnitID, external unique ID, 472*12720SWyllys.Ingersoll@Sun.COM * external tag, description and state. Data units are associated with zero or more keys. 473*12720SWyllys.Ingersoll@Sun.COM */ 474*12720SWyllys.Ingersoll@Sun.COM struct KMSAgent_DataUnit 475*12720SWyllys.Ingersoll@Sun.COM { 476*12720SWyllys.Ingersoll@Sun.COM /** 477*12720SWyllys.Ingersoll@Sun.COM * the unique DataUnit ID provided by the KMS 478*12720SWyllys.Ingersoll@Sun.COM */ 479*12720SWyllys.Ingersoll@Sun.COM DATA_UNIT_ID m_acDataUnitID; 480*12720SWyllys.Ingersoll@Sun.COM 481*12720SWyllys.Ingersoll@Sun.COM /** 482*12720SWyllys.Ingersoll@Sun.COM * a unique external ID for the data unit that is provided by the agent, may be NULL if one is not provided. 483*12720SWyllys.Ingersoll@Sun.COM * The KMS will enforce the uniqueness of this identifier and not allow multiple data units having the same 484*12720SWyllys.Ingersoll@Sun.COM * #m_acExternalUniqueID value. 485*12720SWyllys.Ingersoll@Sun.COM */ 486*12720SWyllys.Ingersoll@Sun.COM EXTERNAL_UNIQUE_ID m_acExternalUniqueID; 487*12720SWyllys.Ingersoll@Sun.COM /** 488*12720SWyllys.Ingersoll@Sun.COM * the length in bytes of the #m_acExternalUniqueID field that represents the 489*12720SWyllys.Ingersoll@Sun.COM * ID. The length 490*12720SWyllys.Ingersoll@Sun.COM * must be less than or equal to #KMS_MAX_EXTERNAL_UNIQUE_ID_SIZE 491*12720SWyllys.Ingersoll@Sun.COM */ 492*12720SWyllys.Ingersoll@Sun.COM int m_iExternalUniqueIDLength; 493*12720SWyllys.Ingersoll@Sun.COM 494*12720SWyllys.Ingersoll@Sun.COM /** 495*12720SWyllys.Ingersoll@Sun.COM * an external tag representing information pertinent to the data unit, for example a volume serial number 496*12720SWyllys.Ingersoll@Sun.COM */ 497*12720SWyllys.Ingersoll@Sun.COM EXTERNAL_TAG m_acExternalTag; 498*12720SWyllys.Ingersoll@Sun.COM 499*12720SWyllys.Ingersoll@Sun.COM /** 500*12720SWyllys.Ingersoll@Sun.COM * a description of the data unit 501*12720SWyllys.Ingersoll@Sun.COM */ 502*12720SWyllys.Ingersoll@Sun.COM DESCRIPTION m_acDescription; 503*12720SWyllys.Ingersoll@Sun.COM 504*12720SWyllys.Ingersoll@Sun.COM /** 505*12720SWyllys.Ingersoll@Sun.COM * the state of the DataUnit 506*12720SWyllys.Ingersoll@Sun.COM */ 507*12720SWyllys.Ingersoll@Sun.COM enum KMS_AGENT_DATA_UNIT_STATE m_iDataUnitState; 508*12720SWyllys.Ingersoll@Sun.COM 509*12720SWyllys.Ingersoll@Sun.COM }; 510*12720SWyllys.Ingersoll@Sun.COM 511*12720SWyllys.Ingersoll@Sun.COM /** 512*12720SWyllys.Ingersoll@Sun.COM * typedef for a list of keys 513*12720SWyllys.Ingersoll@Sun.COM */ 514*12720SWyllys.Ingersoll@Sun.COM typedef struct KMSAgent_ArrayOfKeys KMSAgent_ArrayOfKeys; 515*12720SWyllys.Ingersoll@Sun.COM 516*12720SWyllys.Ingersoll@Sun.COM /** \struct KMSAgent_ArrayOfKeys 517*12720SWyllys.Ingersoll@Sun.COM * struct for an array of keys 518*12720SWyllys.Ingersoll@Sun.COM */ 519*12720SWyllys.Ingersoll@Sun.COM struct KMSAgent_ArrayOfKeys 520*12720SWyllys.Ingersoll@Sun.COM { 521*12720SWyllys.Ingersoll@Sun.COM /** 522*12720SWyllys.Ingersoll@Sun.COM * keys are in chronological order based upon key creation date. However, 523*12720SWyllys.Ingersoll@Sun.COM * when page offset argument to #KMSAgent_RetrieveDataUnitKeys 524*12720SWyllys.Ingersoll@Sun.COM * is 0 the first key in the array will be the key in the 525*12720SWyllys.Ingersoll@Sun.COM * #KMS_KEY_STATE_ACTIVE_PROTECT_AND_PROCESS. 526*12720SWyllys.Ingersoll@Sun.COM */ 527*12720SWyllys.Ingersoll@Sun.COM KMSAgent_Key* m_pKeys; 528*12720SWyllys.Ingersoll@Sun.COM 529*12720SWyllys.Ingersoll@Sun.COM /** 530*12720SWyllys.Ingersoll@Sun.COM * the number of keys in the list 531*12720SWyllys.Ingersoll@Sun.COM */ 532*12720SWyllys.Ingersoll@Sun.COM int m_iSize; 533*12720SWyllys.Ingersoll@Sun.COM }; 534*12720SWyllys.Ingersoll@Sun.COM 535*12720SWyllys.Ingersoll@Sun.COM /** 536*12720SWyllys.Ingersoll@Sun.COM * @return the version string for the KMS Agent Library 537*12720SWyllys.Ingersoll@Sun.COM */ 538*12720SWyllys.Ingersoll@Sun.COM const char * KMSAgent_GetVersion(); 539*12720SWyllys.Ingersoll@Sun.COM 540*12720SWyllys.Ingersoll@Sun.COM /** 541*12720SWyllys.Ingersoll@Sun.COM * 542*12720SWyllys.Ingersoll@Sun.COM * This function initializes the KMS Agent API library. It 543*12720SWyllys.Ingersoll@Sun.COM * should be called before any other functions are invoked. Internally, 544*12720SWyllys.Ingersoll@Sun.COM * sets up the SSL library and Logging module. 545*12720SWyllys.Ingersoll@Sun.COM * 546*12720SWyllys.Ingersoll@Sun.COM * @param i_pWorkingDirectory Working directory of the program which uses the 547*12720SWyllys.Ingersoll@Sun.COM * library. Default is "." if NULL is passed. 548*12720SWyllys.Ingersoll@Sun.COM * @param i_bUseFileLog: True(1) if errors should go to a log file in the working directory. 549*12720SWyllys.Ingersoll@Sun.COM * If false(0) then errors will not be logged to a file. 550*12720SWyllys.Ingersoll@Sun.COM * 551*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 552*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR if library initialization fails 553*12720SWyllys.Ingersoll@Sun.COM */ 554*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_InitializeLibrary( 555*12720SWyllys.Ingersoll@Sun.COM const utf8cstr i_pWorkingDirectory, 556*12720SWyllys.Ingersoll@Sun.COM int i_bUseFileLog ); 557*12720SWyllys.Ingersoll@Sun.COM 558*12720SWyllys.Ingersoll@Sun.COM /** 559*12720SWyllys.Ingersoll@Sun.COM * This function exercises FIPS 140-2 Known Answer Tests for certified algorithms 560*12720SWyllys.Ingersoll@Sun.COM * used in the agent toolkit. This function should only be called once and may 561*12720SWyllys.Ingersoll@Sun.COM * be called prior to #KMSAgent_InitializeLibrary. 562*12720SWyllys.Ingersoll@Sun.COM * 563*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 564*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_FIPS_KAT_AES_KEYWRAP_ERROR 565*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_FIPS_KAT_AES_ECB_ERROR 566*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_FIPS_KAT_HMAC_SHA1_ERROR 567*12720SWyllys.Ingersoll@Sun.COM */ 568*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_KnownAnswerTests(); 569*12720SWyllys.Ingersoll@Sun.COM 570*12720SWyllys.Ingersoll@Sun.COM /** 571*12720SWyllys.Ingersoll@Sun.COM * This function finalizes the KMS Agent API library. It should 572*12720SWyllys.Ingersoll@Sun.COM * be called when the library is not needed by the program. Internally it 573*12720SWyllys.Ingersoll@Sun.COM * cleans up the SSL library and Logging module. 574*12720SWyllys.Ingersoll@Sun.COM * 575*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 576*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR if library finalization fails 577*12720SWyllys.Ingersoll@Sun.COM * 578*12720SWyllys.Ingersoll@Sun.COM */ 579*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_FinalizeLibrary(); 580*12720SWyllys.Ingersoll@Sun.COM 581*12720SWyllys.Ingersoll@Sun.COM /** 582*12720SWyllys.Ingersoll@Sun.COM * This function can be used to get the last error message when 583*12720SWyllys.Ingersoll@Sun.COM * an API function encounters an error. These error messages also 584*12720SWyllys.Ingersoll@Sun.COM * are written to the log, if file logging was enabled during library 585*12720SWyllys.Ingersoll@Sun.COM * initialization. 586*12720SWyllys.Ingersoll@Sun.COM * 587*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile an initialized #KMSClientProfile; the failed 588*12720SWyllys.Ingersoll@Sun.COM * function must have used this profile. 589*12720SWyllys.Ingersoll@Sun.COM * @return the pointer to the last error message or NULL 590*12720SWyllys.Ingersoll@Sun.COM * 591*12720SWyllys.Ingersoll@Sun.COM */ 592*12720SWyllys.Ingersoll@Sun.COM utf8cstr KMSAgent_GetLastErrorMessage( 593*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* i_pProfile ); 594*12720SWyllys.Ingersoll@Sun.COM 595*12720SWyllys.Ingersoll@Sun.COM 596*12720SWyllys.Ingersoll@Sun.COM /** 597*12720SWyllys.Ingersoll@Sun.COM * Get the cluster information by calling the KMS_Discovery service using the KMA specified in the 598*12720SWyllys.Ingersoll@Sun.COM * profile, no load balancing will occur. If discovery to this KMA fails then discovery will be 599*12720SWyllys.Ingersoll@Sun.COM * attempted using previously retrieved cluster information. 600*12720SWyllys.Ingersoll@Sun.COM * 601*12720SWyllys.Ingersoll@Sun.COM * If #KMSAgent_LoadProfile was called with an IPv6 address for 602*12720SWyllys.Ingersoll@Sun.COM * the <code>i_pInitialApplianceAddress</code> argument then the <code>o_pClusterEntryArray</code> will contain 603*12720SWyllys.Ingersoll@Sun.COM * IPv6 addresses instead of IPv4 addresses for each KMA that has an IPv6 address. 604*12720SWyllys.Ingersoll@Sun.COM * @see #KMSAgent_LoadProfile and #KMSAgent_SelectAppliance. 605*12720SWyllys.Ingersoll@Sun.COM * 606*12720SWyllys.Ingersoll@Sun.COM * If the size of the cluster returned by the KMS_Discovery servic exceeds <code>i_iClusterEntryArraySize</code> 607*12720SWyllys.Ingersoll@Sun.COM * then the KMA list is filtered to contain the 608*12720SWyllys.Ingersoll@Sun.COM * first <code>i_iClusterEntryArraySize</code> KMAs that meet the profile's FIPS setting, agent site and are reported as responding by the 609*12720SWyllys.Ingersoll@Sun.COM * KMS discover cluster response. 610*12720SWyllys.Ingersoll@Sun.COM * 611*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile a pointer to an initialized #KMSClientProfile structure 612*12720SWyllys.Ingersoll@Sun.COM * @param i_iEntitySiteIDSize the buffer size of the entity site ID including null terminator 613*12720SWyllys.Ingersoll@Sun.COM * (should be greater than #KMS_MAX_ENTITY_SITE_ID ) 614*12720SWyllys.Ingersoll@Sun.COM * @param i_iClusterEntryArraySize the array size for cluster entries (must be less than or equal to #KMS_MAX_CLUSTER_NUM ) 615*12720SWyllys.Ingersoll@Sun.COM * @param o_pEntitySiteID a buffer allocated by the caller to store the agent's (aka entity) Site ID 616*12720SWyllys.Ingersoll@Sun.COM * @param o_pApplianceNum the returned number of appliances in the cluster 617*12720SWyllys.Ingersoll@Sun.COM * @param o_pClusterEntryArray a buffer allocated by the caller to store the array of cluster entries 618*12720SWyllys.Ingersoll@Sun.COM * 619*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 620*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 621*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 622*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_ACCESS_DENIED 623*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_NOT_LOADED 624*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_SERVER_BUSY 625*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_UNAVAILABLE 626*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_FIPS_KMAS_AVAILABLE 627*12720SWyllys.Ingersoll@Sun.COM */ 628*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_GetClusterInformation( 629*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile * const i_pProfile, 630*12720SWyllys.Ingersoll@Sun.COM int i_iEntitySiteIDSize, 631*12720SWyllys.Ingersoll@Sun.COM int i_iClusterEntryArraySize, 632*12720SWyllys.Ingersoll@Sun.COM utf8cstr const o_pEntitySiteID, 633*12720SWyllys.Ingersoll@Sun.COM int * const o_pApplianceNum, 634*12720SWyllys.Ingersoll@Sun.COM KMSClusterEntry * const o_pClusterEntryArray); 635*12720SWyllys.Ingersoll@Sun.COM 636*12720SWyllys.Ingersoll@Sun.COM /** 637*12720SWyllys.Ingersoll@Sun.COM * Specifies the Key Management Appliance to be used 638*12720SWyllys.Ingersoll@Sun.COM * for retrieving cluster information. 639*12720SWyllys.Ingersoll@Sun.COM * 640*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile a pointer to an initialized #KMSClientProfile 641*12720SWyllys.Ingersoll@Sun.COM * structure 642*12720SWyllys.Ingersoll@Sun.COM * @param i_pApplianceAddress the IP address of the appliance. IPv6 addresses 643*12720SWyllys.Ingersoll@Sun.COM * must be enclosed in brackets, [], see #KMSAgent_LoadProfile. 644*12720SWyllys.Ingersoll@Sun.COM * 645*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 646*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 647*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 648*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_NOT_LOADED 649*12720SWyllys.Ingersoll@Sun.COM * 650*12720SWyllys.Ingersoll@Sun.COM */ 651*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_SelectAppliance( 652*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* const i_pProfile, 653*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pApplianceAddress ); 654*12720SWyllys.Ingersoll@Sun.COM 655*12720SWyllys.Ingersoll@Sun.COM /** 656*12720SWyllys.Ingersoll@Sun.COM * Load profile handles both agent enrollment with the KMS and post enrollment setup. 657*12720SWyllys.Ingersoll@Sun.COM * <p> 658*12720SWyllys.Ingersoll@Sun.COM * <b>Enrollment Behavior</b> 659*12720SWyllys.Ingersoll@Sun.COM * <br> 660*12720SWyllys.Ingersoll@Sun.COM * When a passphrase is supplied enrollment, or reenrollment, with a KMS cluster is attempted in order 661*12720SWyllys.Ingersoll@Sun.COM * to establish a mutual trust relationship. Enrollment occurs with the KMA in the cluster specified 662*12720SWyllys.Ingersoll@Sun.COM * by <code>i_pApplianceAddress</code>. 663*12720SWyllys.Ingersoll@Sun.COM * <p> 664*12720SWyllys.Ingersoll@Sun.COM * The KMS CA web service is used for CA certificate retrieval prior to 665*12720SWyllys.Ingersoll@Sun.COM * invoking the KMS Certificate web service. Certficate retrieval via these services 666*12720SWyllys.Ingersoll@Sun.COM * uses the <code>i_pApplianceAddress</code> for enrollment. Cluster discovery is then performed to 667*12720SWyllys.Ingersoll@Sun.COM * identify the set of KMAs within the cluster. 668*12720SWyllys.Ingersoll@Sun.COM * Successful enrollment results in 669*12720SWyllys.Ingersoll@Sun.COM * persistent storage of the CA X.509 certificate, agent X.509 certificate and private key. 670*12720SWyllys.Ingersoll@Sun.COM * </p> 671*12720SWyllys.Ingersoll@Sun.COM * Once enrolled successfully the KMS 672*12720SWyllys.Ingersoll@Sun.COM * will then disable usage of the agent's passphrase for enrollment as a security precaution. 673*12720SWyllys.Ingersoll@Sun.COM * Subsequent enrollment will require a new passphrase. 674*12720SWyllys.Ingersoll@Sun.COM * <p> 675*12720SWyllys.Ingersoll@Sun.COM * <b>Post Enrollment Behavior</b> 676*12720SWyllys.Ingersoll@Sun.COM * <br> 677*12720SWyllys.Ingersoll@Sun.COM * When a passphrase is not provided a profile is assumed to exist and the library profile structure 678*12720SWyllys.Ingersoll@Sun.COM * is initialized from persistent storage with the configuration settings(agent ID, 679*12720SWyllys.Ingersoll@Sun.COM * KMA service port numbers, KMA Address, transaction timeout, discovery frequency, transaction timeout 680*12720SWyllys.Ingersoll@Sun.COM * and failover limit), cluster information(agent's site ID and KMA cluster information and KMA status) and 681*12720SWyllys.Ingersoll@Sun.COM * enrollment items: the CA certificate, Agent Certificate and agent private key. 682*12720SWyllys.Ingersoll@Sun.COM * <p> 683*12720SWyllys.Ingersoll@Sun.COM * Finally, cluster discovery is performed(unless disabled), and a load balancer is initialized 684*12720SWyllys.Ingersoll@Sun.COM * for balancing transactions across KMAs within the 685*12720SWyllys.Ingersoll@Sun.COM * cluster and for handling transaction failover scenarios. 686*12720SWyllys.Ingersoll@Sun.COM * Subsequent API calls using the profile will invoke cluster discovery at the frequency specified 687*12720SWyllys.Ingersoll@Sun.COM * by <code>iClusterDiscoveryFrequency</code>. Updated discovery information is persisted with the 688*12720SWyllys.Ingersoll@Sun.COM * profile. The load balancer maintains affinity to KMAs within the same site as the agent for 689*12720SWyllys.Ingersoll@Sun.COM * agent transactions unless an error requires failover 690*12720SWyllys.Ingersoll@Sun.COM * to another KMA in the cluster. An agent's site ID may also be updated by a discovery 691*12720SWyllys.Ingersoll@Sun.COM * operation. 692*12720SWyllys.Ingersoll@Sun.COM * 693*12720SWyllys.Ingersoll@Sun.COM * @param io_pProfile a pointer to a #KMSClientProfile buffer allocated by the caller 694*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfileName the profile name 695*12720SWyllys.Ingersoll@Sun.COM * @param i_pAgentID Optional. For a new profile the encryption agent's ID is required. 696*12720SWyllys.Ingersoll@Sun.COM * @param i_pPassphrase Optional. For a new profile the encryption agent's passphrase is required. This passphrase 697*12720SWyllys.Ingersoll@Sun.COM * may only be used once for a successful retrieval of the Certificate and agent private key. 698*12720SWyllys.Ingersoll@Sun.COM * @param i_pInitialApplianceAddress the initial IP Address of an Appliance in the KMS Cluster that is reachable by this agent. If 699*12720SWyllys.Ingersoll@Sun.COM * enrollment has previously occurred specification of an initial IP address that is not 700*12720SWyllys.Ingersoll@Sun.COM * a member of the profile's cluster information will force the cluster information 701*12720SWyllys.Ingersoll@Sun.COM * to be deleted and discovery to be performed with the new IP address. 702*12720SWyllys.Ingersoll@Sun.COM * An IPv6 address may be supplied but must be enclosed with brackets, [], in accordance 703*12720SWyllys.Ingersoll@Sun.COM * with RFC 2396, "Format for Literal IPv6 Addresses in URL's". Supplying an IPv6 address will cause 704*12720SWyllys.Ingersoll@Sun.COM * the agent library to utilize KMA IPv6 addresses over IPv4 addresses when they are available, 705*12720SWyllys.Ingersoll@Sun.COM * otherwise IPv4 KMA addresses will be used. 706*12720SWyllys.Ingersoll@Sun.COM * @param i_iTransactionTimeout the timeout setting for a transaction in seconds, must be a positive value. 707*12720SWyllys.Ingersoll@Sun.COM * @param i_iFailOverLimit Failed KMA transactions will be retried up to this limit. Once this limit 708*12720SWyllys.Ingersoll@Sun.COM * has been reached API calls will return #KMS_AGENT_STATUS_KMS_UNAVAILABLE. 709*12720SWyllys.Ingersoll@Sun.COM * Specify -1 for unlimited failover attempts, 0 for no failover. The worst case completion time for 710*12720SWyllys.Ingersoll@Sun.COM * an API call is approximately equal to <code>i_iFailOverLimit</code> * <code>i_iTransactionTimeout</code>. 711*12720SWyllys.Ingersoll@Sun.COM * 712*12720SWyllys.Ingersoll@Sun.COM * @param i_iClusterDiscoveryFrequency 713*12720SWyllys.Ingersoll@Sun.COM * frequency of calling cluster discovery service 714*12720SWyllys.Ingersoll@Sun.COM * in seconds (use 0 to disable load balancing and periodic cluster discovery) 715*12720SWyllys.Ingersoll@Sun.COM * @param i_eKMSmode specifies the KMS operational mode that the 716*12720SWyllys.Ingersoll@Sun.COM * agent should enforce. Setting this to #FIPS_MODE 717*12720SWyllys.Ingersoll@Sun.COM * causes the agent to only communicate with KMAs in the 718*12720SWyllys.Ingersoll@Sun.COM * cluster that support AES key wrapping for key requests. 719*12720SWyllys.Ingersoll@Sun.COM * This is not a persisted setting and is only applicable 720*12720SWyllys.Ingersoll@Sun.COM * to the current session. 721*12720SWyllys.Ingersoll@Sun.COM * 722*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 723*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 724*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 725*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_NOT_LOADED 726*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_ALREADY_LOADED 727*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_ACCESS_DENIED 728*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_SERVER_BUSY 729*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_UNAVAILABLE 730*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_FIPS_KMAS_AVAILABLE 731*12720SWyllys.Ingersoll@Sun.COM */ 732*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_LoadProfile( 733*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* const io_pProfile, 734*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pProfileName, 735*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pAgentID, 736*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pPassphrase, 737*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pInitialApplianceAddress, 738*12720SWyllys.Ingersoll@Sun.COM int i_iTransactionTimeout, 739*12720SWyllys.Ingersoll@Sun.COM int i_iFailOverLimit, 740*12720SWyllys.Ingersoll@Sun.COM int i_iClusterDiscoveryFrequency, 741*12720SWyllys.Ingersoll@Sun.COM int i_eKMSmode ); 742*12720SWyllys.Ingersoll@Sun.COM 743*12720SWyllys.Ingersoll@Sun.COM 744*12720SWyllys.Ingersoll@Sun.COM /** 745*12720SWyllys.Ingersoll@Sun.COM * Destroy the profile information in memory, the agent's profile configuration, 746*12720SWyllys.Ingersoll@Sun.COM * cluster information, certificate and 747*12720SWyllys.Ingersoll@Sun.COM * private key are retained in persistant storage. 748*12720SWyllys.Ingersoll@Sun.COM * 749*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile a pointer to an initialized KMSClientProfile 750*12720SWyllys.Ingersoll@Sun.COM * structure. 751*12720SWyllys.Ingersoll@Sun.COM * 752*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 753*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 754*12720SWyllys.Ingersoll@Sun.COM * 755*12720SWyllys.Ingersoll@Sun.COM */ 756*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_UnloadProfile( 757*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* const i_pProfile ); 758*12720SWyllys.Ingersoll@Sun.COM 759*12720SWyllys.Ingersoll@Sun.COM /** 760*12720SWyllys.Ingersoll@Sun.COM * Delete the profile information from persistent storage. The agent's profile configuration, 761*12720SWyllys.Ingersoll@Sun.COM * cluster information, certificate and 762*12720SWyllys.Ingersoll@Sun.COM * private key are discared, see #KMSAgent_LoadProfile for how to initialize 763*12720SWyllys.Ingersoll@Sun.COM * the profile again. The profile should be unloaded prior to making this call. 764*12720SWyllys.Ingersoll@Sun.COM * 765*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfileName the profile name 766*12720SWyllys.Ingersoll@Sun.COM * 767*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 768*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 769*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 770*12720SWyllys.Ingersoll@Sun.COM */ 771*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_DeleteProfile( 772*12720SWyllys.Ingersoll@Sun.COM utf8cstr i_pProfileName ); 773*12720SWyllys.Ingersoll@Sun.COM 774*12720SWyllys.Ingersoll@Sun.COM /** 775*12720SWyllys.Ingersoll@Sun.COM * Fetch the key groups this agent is allowed to access. The caller should invoke #KMSAgent_FreeArrayOfKeyGroups 776*12720SWyllys.Ingersoll@Sun.COM * to release the allocated memory resources for the array. Up to #KMS_MAX_LIST_KEY_GROUPS key groups will be 777*12720SWyllys.Ingersoll@Sun.COM * returned. 778*12720SWyllys.Ingersoll@Sun.COM * 779*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile an initialized #KMSClientProfile 780*12720SWyllys.Ingersoll@Sun.COM * @param o_ppKeyGroups a buffer allocated by this routine for the array of Key Groups and individual key groups 781*12720SWyllys.Ingersoll@Sun.COM * that this agent is allowed to access 782*12720SWyllys.Ingersoll@Sun.COM * 783*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 784*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 785*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_NOT_LOADED 786*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_MEMORY 787*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 788*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_ACCESS_DENIED 789*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 790*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_SERVER_BUSY 791*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_UNAVAILABLE 792*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_FIPS_KMAS_AVAILABLE 793*12720SWyllys.Ingersoll@Sun.COM */ 794*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_ListKeyGroups( 795*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* const i_pProfile, 796*12720SWyllys.Ingersoll@Sun.COM KMSAgent_ArrayOfKeyGroups** const o_ppKeyGroups ); 797*12720SWyllys.Ingersoll@Sun.COM 798*12720SWyllys.Ingersoll@Sun.COM /** 799*12720SWyllys.Ingersoll@Sun.COM * Helper function which frees memory allocated for the output 800*12720SWyllys.Ingersoll@Sun.COM * to #KMSAgent_ListKeyGroups. 801*12720SWyllys.Ingersoll@Sun.COM * 802*12720SWyllys.Ingersoll@Sun.COM * @param i_pArrayOfKeyGroups a pointer to #KMSAgent_ArrayOfKeyGroups 803*12720SWyllys.Ingersoll@Sun.COM * 804*12720SWyllys.Ingersoll@Sun.COM * @return void 805*12720SWyllys.Ingersoll@Sun.COM * 806*12720SWyllys.Ingersoll@Sun.COM */ 807*12720SWyllys.Ingersoll@Sun.COM void KMSAgent_FreeArrayOfKeyGroups( 808*12720SWyllys.Ingersoll@Sun.COM KMSAgent_ArrayOfKeyGroups* i_pArrayOfKeyGroups ); 809*12720SWyllys.Ingersoll@Sun.COM 810*12720SWyllys.Ingersoll@Sun.COM /** 811*12720SWyllys.Ingersoll@Sun.COM * Creates a Key for the specified data unit. If a data unit is provided then the key will be associated with 812*12720SWyllys.Ingersoll@Sun.COM * the data unit. The type of key created is dictated by the KMS key policy for the key group. This policy is set up by KMS 813*12720SWyllys.Ingersoll@Sun.COM * administrators to be compatible with agents associated with the key group. 814*12720SWyllys.Ingersoll@Sun.COM * If KeyGroup is provided then the new key is associated with the specified KeyGroup, otherwise the agent's 815*12720SWyllys.Ingersoll@Sun.COM * default KeyGroup is associated with the key. 816*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile an initialized #KMSClientProfile 817*12720SWyllys.Ingersoll@Sun.COM * @param i_pDataUnit Optional. a pointer to a data unit to be associated with the key, if known. 818*12720SWyllys.Ingersoll@Sun.COM * @param i_pKeyGroupID Optional, the KeyGroup ID to be assigned to the new Key, if known. Pass NULL 819*12720SWyllys.Ingersoll@Sun.COM * if unknown and the new key will be associated with the agent's default key group 820*12720SWyllys.Ingersoll@Sun.COM * @param o_pKey A pointer to a buffer for returning the new key and key associated data. 821*12720SWyllys.Ingersoll@Sun.COM * 822*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 823*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 824*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_NOT_LOADED 825*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_MEMORY 826*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KEY_CALLOUT_FAILURE 827*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 828*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_ACCESS_DENIED 829*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_SERVER_BUSY 830*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_EXTERNAL_UNIQUE_ID_EXISTS 831*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_UNAVAILABLE 832*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_NO_READY_KEYS 833*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_FIPS_KMAS_AVAILABLE 834*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_AES_KEY_UNWRAP_ERROR 835*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_AES_KEY_WRAP_SETUP_ERROR 836*12720SWyllys.Ingersoll@Sun.COM */ 837*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_CreateKey( 838*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* const i_pProfile, 839*12720SWyllys.Ingersoll@Sun.COM const KMSAgent_DataUnit* const i_pDataUnit, 840*12720SWyllys.Ingersoll@Sun.COM KEY_GROUP_ID const i_pKeyGroupID, 841*12720SWyllys.Ingersoll@Sun.COM KMSAgent_Key* const o_pKey); 842*12720SWyllys.Ingersoll@Sun.COM 843*12720SWyllys.Ingersoll@Sun.COM /** 844*12720SWyllys.Ingersoll@Sun.COM * Creates a DataUnit with the specified external unique id and external tag. 845*12720SWyllys.Ingersoll@Sun.COM * 846*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile an initialized #KMSClientProfile 847*12720SWyllys.Ingersoll@Sun.COM * @param i_pExternalUniqueID Optional. A unique data unit identifier to be associated with 848*12720SWyllys.Ingersoll@Sun.COM * the data unit. Uniqueness is enforced by the KMS. See also #KMSAgent_RetrieveDataUnit. 849*12720SWyllys.Ingersoll@Sun.COM * @param i_iExternalUniqueIDIDLen Length in bytes of the external unique identifier. If 850*12720SWyllys.Ingersoll@Sun.COM * <code>i_pExternalUniqueID</code> is NULL then this field is ignored, otherwise a positive length must be provided. 851*12720SWyllys.Ingersoll@Sun.COM * @param i_pExternalTag Optional, but recommended. Pointer to an External Tag for the data unit, e.g. a volume serial number. 852*12720SWyllys.Ingersoll@Sun.COM * @param i_pDescription Optional, a textual description of the data unit. 853*12720SWyllys.Ingersoll@Sun.COM * @param o_pDataUnit a pointer to a DataUnit buffer where 854*12720SWyllys.Ingersoll@Sun.COM * data unit information is returned 855*12720SWyllys.Ingersoll@Sun.COM * 856*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 857*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 858*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_NOT_LOADED 859*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_MEMORY 860*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 861*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_ACCESS_DENIED 862*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_SERVER_BUSY 863*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_EXTERNAL_UNIQUE_ID_EXISTS 864*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_UNAVAILABLE 865*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_FIPS_KMAS_AVAILABLE 866*12720SWyllys.Ingersoll@Sun.COM */ 867*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_CreateDataUnit( 868*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* const i_pProfile, 869*12720SWyllys.Ingersoll@Sun.COM const unsigned char * i_pExternalUniqueID, 870*12720SWyllys.Ingersoll@Sun.COM int i_iExternalUniqueIDIDLen, 871*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pExternalTag, 872*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pDescription, 873*12720SWyllys.Ingersoll@Sun.COM KMSAgent_DataUnit* const o_pDataUnit); 874*12720SWyllys.Ingersoll@Sun.COM 875*12720SWyllys.Ingersoll@Sun.COM /** 876*12720SWyllys.Ingersoll@Sun.COM * The agent may use this function to inform the KMS that the DataUnit has, or will be, overwritten. 877*12720SWyllys.Ingersoll@Sun.COM * The KMS will remove the association from the specified DataUnit to all its keys, excluding its key 878*12720SWyllys.Ingersoll@Sun.COM * in the #KMS_KEY_STATE_ACTIVE_PROTECT_AND_PROCESS state. By utilizing this API, agent's can help keep the 879*12720SWyllys.Ingersoll@Sun.COM * number of keys returned by #KMSAgent_RetrieveDataUnitKeys to just the keys being used on the Data Unit. 880*12720SWyllys.Ingersoll@Sun.COM * 881*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile an initialized #KMSClientProfile 882*12720SWyllys.Ingersoll@Sun.COM * @param i_pDataUnit A pointer to the data unit 883*12720SWyllys.Ingersoll@Sun.COM * 884*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 885*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 886*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_NOT_LOADED 887*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_MEMORY 888*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 889*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_ACCESS_DENIED 890*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_SERVER_BUSY 891*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_EXTERNAL_UNIQUE_ID_EXISTS 892*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_UNAVAILABLE 893*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_FIPS_KMAS_AVAILABLE 894*12720SWyllys.Ingersoll@Sun.COM */ 895*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_DisassociateDataUnitKeys( 896*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* const i_pProfile, 897*12720SWyllys.Ingersoll@Sun.COM const KMSAgent_DataUnit* const i_pDataUnit); 898*12720SWyllys.Ingersoll@Sun.COM 899*12720SWyllys.Ingersoll@Sun.COM 900*12720SWyllys.Ingersoll@Sun.COM /** 901*12720SWyllys.Ingersoll@Sun.COM * retrieve a key by the Key's ID, optionally specifying the Data Unit and KeyGroup to be 902*12720SWyllys.Ingersoll@Sun.COM * associated with the key. Supplying the Data Unit information allows the KMS to add an 903*12720SWyllys.Ingersoll@Sun.COM * association between the Key and the Data Unit. The assumption being made is that the key being 904*12720SWyllys.Ingersoll@Sun.COM * retrieved has been used on the specified Data Unit and needs to be associated with it. This 905*12720SWyllys.Ingersoll@Sun.COM * side affect allows the KMS to build up its knowledge of key usage as it relies upon agents 906*12720SWyllys.Ingersoll@Sun.COM * for discovering and reporting how keys are being used on Data Units. For example, when keys 907*12720SWyllys.Ingersoll@Sun.COM * are imported into a KMS the information associating keys with DataUnits may not be provided, 908*12720SWyllys.Ingersoll@Sun.COM * consequently the KMS is unaware of what DataUnits were encrypted with a particular key. 909*12720SWyllys.Ingersoll@Sun.COM * 910*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile an initialized KMSClientProfile 911*12720SWyllys.Ingersoll@Sun.COM * @param i_pKeyID The ID of the Key being requested 912*12720SWyllys.Ingersoll@Sun.COM * @param i_pDataUnit Optional. If non-NULL, the KMS will verify that an association exists between the key and the Data Unit and create 913*12720SWyllys.Ingersoll@Sun.COM * the association if it is missing. 914*12720SWyllys.Ingersoll@Sun.COM * @param i_pKeyGroupID Optional. If non-NULL, and the key is not already associated with a KeyGroup, then the KMS will associate the key with the specified KeyGroup. 915*12720SWyllys.Ingersoll@Sun.COM * @param o_pKey A pointer to a buffer allcoated by the caller for returning the new key and key associated data. 916*12720SWyllys.Ingersoll@Sun.COM * 917*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 918*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 919*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_NOT_LOADED 920*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_MEMORY 921*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KEY_CALLOUT_FAILURE 922*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 923*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_ACCESS_DENIED 924*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_SERVER_BUSY 925*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_EXTERNAL_UNIQUE_ID_EXISTS 926*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KEY_DOES_NOT_EXIST 927*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KEY_DESTROYED 928*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_UNAVAILABLE 929*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_FIPS_KMAS_AVAILABLE 930*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_AES_KEY_UNWRAP_ERROR 931*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_AES_KEY_WRAP_SETUP_ERROR 932*12720SWyllys.Ingersoll@Sun.COM */ 933*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_RetrieveKey( 934*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* const i_pProfile, 935*12720SWyllys.Ingersoll@Sun.COM const unsigned char * const i_pKeyID, 936*12720SWyllys.Ingersoll@Sun.COM const KMSAgent_DataUnit* const i_pDataUnit, 937*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pKeyGroupID, 938*12720SWyllys.Ingersoll@Sun.COM KMSAgent_Key* const o_pKey); 939*12720SWyllys.Ingersoll@Sun.COM 940*12720SWyllys.Ingersoll@Sun.COM /** 941*12720SWyllys.Ingersoll@Sun.COM * Retrieve a Data Unit by its data unit identifier. 942*12720SWyllys.Ingersoll@Sun.COM * 943*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile an initialized #KMSClientProfile 944*12720SWyllys.Ingersoll@Sun.COM * @param i_pDataUnitID the data unit ID by which retrieval will be performed 945*12720SWyllys.Ingersoll@Sun.COM * @param i_pExternalUniqueID Optional, a unique data unit identifier to be associated with 946*12720SWyllys.Ingersoll@Sun.COM * the data unit. Uniqueness is enforced by the KMS. 947*12720SWyllys.Ingersoll@Sun.COM * @param i_iExternalUniqueIDLen Length in bytes of the external unique identifier, must be positive. If 948*12720SWyllys.Ingersoll@Sun.COM * <code>i_pExternalUniqueID</code> is NULL then this field is ignored. 949*12720SWyllys.Ingersoll@Sun.COM * @param i_pExternalTag Optional, but recommended. Pointer to a data unit external tag, e.g. volser 950*12720SWyllys.Ingersoll@Sun.COM * @param i_pDescription Optional, a textual description of the data unit. 951*12720SWyllys.Ingersoll@Sun.COM * @param o_pDataUnit a pointer to a DataUnit buffer allocated by the caller where 952*12720SWyllys.Ingersoll@Sun.COM * data unit information is returned 953*12720SWyllys.Ingersoll@Sun.COM * 954*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 955*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 956*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_NOT_LOADED 957*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_MEMORY 958*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 959*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_ACCESS_DENIED 960*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_SERVER_BUSY 961*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_EXTERNAL_UNIQUE_ID_EXISTS 962*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_UNAVAILABLE 963*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_FIPS_KMAS_AVAILABLE 964*12720SWyllys.Ingersoll@Sun.COM */ 965*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_RetrieveDataUnit( 966*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* const i_pProfile, 967*12720SWyllys.Ingersoll@Sun.COM const unsigned char * const i_pDataUnitID, 968*12720SWyllys.Ingersoll@Sun.COM const unsigned char * const i_pExternalUniqueID, 969*12720SWyllys.Ingersoll@Sun.COM int i_iExternalUniqueIDLen, 970*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pExternalTag, 971*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pDescription, 972*12720SWyllys.Ingersoll@Sun.COM KMSAgent_DataUnit* const o_pDataUnit); 973*12720SWyllys.Ingersoll@Sun.COM 974*12720SWyllys.Ingersoll@Sun.COM /** 975*12720SWyllys.Ingersoll@Sun.COM * Retrieve a Data Unit by its external unique identifier. 976*12720SWyllys.Ingersoll@Sun.COM * If the KMS does not contain a data unit with the specified unique identifier then a data unit will 977*12720SWyllys.Ingersoll@Sun.COM * be created. The new data unit will contain the external unique identifier and the external tag, if 978*12720SWyllys.Ingersoll@Sun.COM * provided. 979*12720SWyllys.Ingersoll@Sun.COM * 980*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile an initialized #KMSClientProfile 981*12720SWyllys.Ingersoll@Sun.COM * @param i_pExternalUniqueID A unique data unit identifier to be associated with 982*12720SWyllys.Ingersoll@Sun.COM * the data unit. Uniqueness is enforced by the KMS. 983*12720SWyllys.Ingersoll@Sun.COM * @param i_iExternalUniqueIDLen Length in bytes of the external unique identifier, must be positive. 984*12720SWyllys.Ingersoll@Sun.COM * @param i_pExternalTag Optional, but recommended. Pointer to a data unit external tag, e.g. volser 985*12720SWyllys.Ingersoll@Sun.COM * @param i_pDescription Optional, a textual description of the data unit. 986*12720SWyllys.Ingersoll@Sun.COM * @param o_pDataUnit a pointer to a DataUnit buffer allocated by the caller where 987*12720SWyllys.Ingersoll@Sun.COM * data unit information is returned 988*12720SWyllys.Ingersoll@Sun.COM * 989*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 990*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 991*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_NOT_LOADED 992*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_MEMORY 993*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 994*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_ACCESS_DENIED 995*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_SERVER_BUSY 996*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_EXTERNAL_UNIQUE_ID_EXISTS 997*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_UNAVAILABLE 998*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_FIPS_KMAS_AVAILABLE 999*12720SWyllys.Ingersoll@Sun.COM */ 1000*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_RetrieveDataUnitByExternalUniqueID( 1001*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* const i_pProfile, 1002*12720SWyllys.Ingersoll@Sun.COM const unsigned char* const i_pExternalUniqueID, 1003*12720SWyllys.Ingersoll@Sun.COM int i_iExternalUniqueIDLen, 1004*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pExternalTag, 1005*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pDescription, 1006*12720SWyllys.Ingersoll@Sun.COM KMSAgent_DataUnit* const o_pDataUnit); 1007*12720SWyllys.Ingersoll@Sun.COM 1008*12720SWyllys.Ingersoll@Sun.COM /** 1009*12720SWyllys.Ingersoll@Sun.COM * retrieve keys assigned to a Data Unit. 1010*12720SWyllys.Ingersoll@Sun.COM * Agents should consult the state of each key that is returned and only 1011*12720SWyllys.Ingersoll@Sun.COM * use the key in the #KMS_KEY_STATE_ACTIVE_PROTECT_AND_PROCESS state for encryption. The agent service 1012*12720SWyllys.Ingersoll@Sun.COM * attempts to return the most recently created key in the #KMS_KEY_STATE_ACTIVE_PROTECT_AND_PROCESS state 1013*12720SWyllys.Ingersoll@Sun.COM * as the first key in the list when a <code>i_pKeyID</code> is not specified. This cannot be guaranteed as 1014*12720SWyllys.Ingersoll@Sun.COM * there may not be a key in the #KMS_KEY_STATE_ACTIVE_PROTECT_AND_PROCESS state for the specified 1015*12720SWyllys.Ingersoll@Sun.COM * data unit. The rest of the keys returned are sorted in ascending order by the time in which 1016*12720SWyllys.Ingersoll@Sun.COM * they were created on the server. 1017*12720SWyllys.Ingersoll@Sun.COM * #KMSAgent_DisassociateDataUnitKeys may be used to manage the 1018*12720SWyllys.Ingersoll@Sun.COM * size of the key list associated with a data unit. 1019*12720SWyllys.Ingersoll@Sun.COM * The <code>i_iPageSize</code>, <code>i_iPageOffset</code> and <code>o_piKeysRemaining</code> parameters may be used for retrieving 1020*12720SWyllys.Ingersoll@Sun.COM * subsets of the list. For the <code>i_pKeyID</code> argument see the parameter's description. 1021*12720SWyllys.Ingersoll@Sun.COM * Callers should invoke#KMSAgent_FreeArrayOfKeys when finished with the buffer of keys. 1022*12720SWyllys.Ingersoll@Sun.COM * 1023*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile an initialized #KMSClientProfile 1024*12720SWyllys.Ingersoll@Sun.COM * @param i_pDataUnit The Data Unit for which all keys will be retrieved. 1025*12720SWyllys.Ingersoll@Sun.COM * @param i_iPageSize the number of keys to be retrieved, up to #KMS_MAX_PAGE_SIZE. 1026*12720SWyllys.Ingersoll@Sun.COM * @param i_iPageOffset the offset from the start of the data unit's key list. Set this to zero for 1027*12720SWyllys.Ingersoll@Sun.COM * retrieval from the start of the list or if <code>i_pKeyID</code> is non-null. 1028*12720SWyllys.Ingersoll@Sun.COM * When set to zero the first key returned in the list 1029*12720SWyllys.Ingersoll@Sun.COM * will be the most recently created key in the #KMS_KEY_STATE_ACTIVE_PROTECT_AND_PROCESS state. 1030*12720SWyllys.Ingersoll@Sun.COM * @param o_piKeysRemaining a pointer to an integer where the number of keys remaining in the list will be returned 1031*12720SWyllys.Ingersoll@Sun.COM * @param i_pKeyID Optional. If non-null, the caller provides a pointer to a KeyID that is used for 1032*12720SWyllys.Ingersoll@Sun.COM * the retrieval and the list returned begins with the specified data unit's KeyID and up to 1033*12720SWyllys.Ingersoll@Sun.COM * <code>i_iPageSize</code> keys associated with the data unit having an activation date greater than the key 1034*12720SWyllys.Ingersoll@Sun.COM * corresponding to <code>i_pKeyID</code>. The first key in the list is not guaranteed 1035*12720SWyllys.Ingersoll@Sun.COM * to be in the #KMS_KEY_STATE_ACTIVE_PROTECT_AND_PROCESS state. If the specified <code>i_pKeyID</code> 1036*12720SWyllys.Ingersoll@Sun.COM * is not associated with the Data Unit then the behavior is like #KMSAgent_RetrieveKey and 1037*12720SWyllys.Ingersoll@Sun.COM * a single key is returned. 1038*12720SWyllys.Ingersoll@Sun.COM * When non-null the <code>i_iPageOffset</code> 1039*12720SWyllys.Ingersoll@Sun.COM * argument must be 0, these arguments are mutually exclusive. 1040*12720SWyllys.Ingersoll@Sun.COM * @param o_ppKeys a pointer to pointer to a #KMSAgent_ArrayOfKeys struct allocated by this routine for returning the specified number of 1041*12720SWyllys.Ingersoll@Sun.COM * Data Unit's keys and key associated data. Up to <code>i_iPageSize</code> 1042*12720SWyllys.Ingersoll@Sun.COM * keys will be returned. Callers should invoke #KMSAgent_FreeArrayOfKeys 1043*12720SWyllys.Ingersoll@Sun.COM * when finished with the buffer of keys. 1044*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 1045*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 1046*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_NOT_LOADED 1047*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_MEMORY 1048*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 1049*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_ACCESS_DENIED 1050*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KEY_CALLOUT_FAILURE 1051*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_SERVER_BUSY 1052*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_EXTERNAL_UNIQUE_ID_EXISTS 1053*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_UNAVAILABLE 1054*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KEY_DOES_NOT_EXIST if <code>i_pKeyID</code> does not exist in the KMS. 1055*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KEY_DESTROYED if <code>i_pKeyID</code> has been destroyed. 1056*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_FIPS_KMAS_AVAILABLE 1057*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_AES_KEY_UNWRAP_ERROR 1058*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_AES_KEY_WRAP_SETUP_ERROR 1059*12720SWyllys.Ingersoll@Sun.COM */ 1060*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_RetrieveDataUnitKeys( 1061*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* const i_pProfile, 1062*12720SWyllys.Ingersoll@Sun.COM const KMSAgent_DataUnit* const i_pDataUnit, 1063*12720SWyllys.Ingersoll@Sun.COM int i_iPageSize, 1064*12720SWyllys.Ingersoll@Sun.COM int i_iPageOffset, 1065*12720SWyllys.Ingersoll@Sun.COM int* const o_piKeysRemaining, 1066*12720SWyllys.Ingersoll@Sun.COM const unsigned char * const i_pKeyID, 1067*12720SWyllys.Ingersoll@Sun.COM KMSAgent_ArrayOfKeys** const o_ppKeys); 1068*12720SWyllys.Ingersoll@Sun.COM 1069*12720SWyllys.Ingersoll@Sun.COM /** 1070*12720SWyllys.Ingersoll@Sun.COM * returns a key in the #KMS_KEY_STATE_ACTIVE_PROTECT_AND_PROCESS for the specified data unit. A new 1071*12720SWyllys.Ingersoll@Sun.COM * key will be created if the data unit does not have a key in the protect and process state or if the 1072*12720SWyllys.Ingersoll@Sun.COM * agent is not authorized to access the key in the protect and process state. 1073*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile an initialized #KMSClientProfile 1074*12720SWyllys.Ingersoll@Sun.COM * @param i_pDataUnit The Data Unit for which a key in the protect and process state will be returned. 1075*12720SWyllys.Ingersoll@Sun.COM * @param i_pKeyGroupID Optional. If non-NULL and a new key is to be created, the KMS will associate the key with the specified KeyGroup 1076*12720SWyllys.Ingersoll@Sun.COM * @param o_pKey A pointer to a buffer for returning the protect and process key. If the data unit 1077*12720SWyllys.Ingersoll@Sun.COM * is associated with multiple keys in the protect and process state then the 1078*12720SWyllys.Ingersoll@Sun.COM * most recently created protect and process key is returned. 1079*12720SWyllys.Ingersoll@Sun.COM * 1080*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 1081*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 1082*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_NOT_LOADED 1083*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_MEMORY 1084*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 1085*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_ACCESS_DENIED 1086*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KEY_CALLOUT_FAILURE 1087*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_SERVER_BUSY 1088*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_EXTERNAL_UNIQUE_ID_EXISTS 1089*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_UNAVAILABLE 1090*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_NO_READY_KEYS 1091*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_FIPS_KMAS_AVAILABLE 1092*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_AES_KEY_UNWRAP_ERROR 1093*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_AES_KEY_WRAP_SETUP_ERROR 1094*12720SWyllys.Ingersoll@Sun.COM */ 1095*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_RetrieveProtectAndProcessKey( 1096*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* const i_pProfile, 1097*12720SWyllys.Ingersoll@Sun.COM const KMSAgent_DataUnit* const i_pDataUnit, 1098*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pKeyGroupID, 1099*12720SWyllys.Ingersoll@Sun.COM KMSAgent_Key* const o_pKey); 1100*12720SWyllys.Ingersoll@Sun.COM 1101*12720SWyllys.Ingersoll@Sun.COM /** 1102*12720SWyllys.Ingersoll@Sun.COM * Helper function which frees memory allocated for the output to #KMSAgent_RetrieveDataUnitKeys. 1103*12720SWyllys.Ingersoll@Sun.COM * @param i_pArrayOfKeys The array of keys to be freed 1104*12720SWyllys.Ingersoll@Sun.COM */ 1105*12720SWyllys.Ingersoll@Sun.COM void KMSAgent_FreeArrayOfKeys( 1106*12720SWyllys.Ingersoll@Sun.COM KMSAgent_ArrayOfKeys* i_pArrayOfKeys); 1107*12720SWyllys.Ingersoll@Sun.COM 1108*12720SWyllys.Ingersoll@Sun.COM /** 1109*12720SWyllys.Ingersoll@Sun.COM * create an entry in the KMS audit log 1110*12720SWyllys.Ingersoll@Sun.COM * 1111*12720SWyllys.Ingersoll@Sun.COM * @param i_pProfile an initialized #KMSClientProfile 1112*12720SWyllys.Ingersoll@Sun.COM * @param i_iRetention the retention of audit log, can be one of: 1113*12720SWyllys.Ingersoll@Sun.COM * #KMS_AUDIT_LOG_LONG_TERM_RETENTION 1114*12720SWyllys.Ingersoll@Sun.COM * #KMS_AUDIT_LOG_MEDIUM_TERM_RETENTION 1115*12720SWyllys.Ingersoll@Sun.COM * #KMS_AUDIT_LOG_SHORT_TERM_RETENTION 1116*12720SWyllys.Ingersoll@Sun.COM * @param i_iCondition the condition of audit log, can be one of: 1117*12720SWyllys.Ingersoll@Sun.COM * #KMS_AUDIT_LOG_SUCCESS_CONDITION 1118*12720SWyllys.Ingersoll@Sun.COM * #KMS_AUDIT_LOG_ERROR_CONDITION 1119*12720SWyllys.Ingersoll@Sun.COM * #KMS_AUDIT_LOG_WARNING_CONDITION 1120*12720SWyllys.Ingersoll@Sun.COM * @param i_bIssueAlert issue alert (SNMP INFORM) for this audit 1121*12720SWyllys.Ingersoll@Sun.COM * @param i_pMessage the message text to be logged 1122*12720SWyllys.Ingersoll@Sun.COM * 1123*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_OK 1124*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_INVALID_PARAMETER 1125*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_PROFILE_NOT_LOADED 1126*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_GENERIC_ERROR 1127*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_ACCESS_DENIED 1128*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_SERVER_BUSY 1129*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_KMS_UNAVAILABLE 1130*12720SWyllys.Ingersoll@Sun.COM * @return #KMS_AGENT_STATUS_NO_FIPS_KMAS_AVAILABLE 1131*12720SWyllys.Ingersoll@Sun.COM */ 1132*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_CreateAuditLog( 1133*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* i_pProfile, 1134*12720SWyllys.Ingersoll@Sun.COM enum KMS_AUDIT_LOG_RETENTION i_iRetention, 1135*12720SWyllys.Ingersoll@Sun.COM enum KMS_AUDIT_LOG_CONDITION i_iCondition, 1136*12720SWyllys.Ingersoll@Sun.COM int i_bIssueAlert, 1137*12720SWyllys.Ingersoll@Sun.COM utf8cstr i_pMessage ); 1138*12720SWyllys.Ingersoll@Sun.COM 1139*12720SWyllys.Ingersoll@Sun.COM 1140*12720SWyllys.Ingersoll@Sun.COM #ifdef KMSUSERPKCS12 1141*12720SWyllys.Ingersoll@Sun.COM #include <sys/types.h> 1142*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS KMSAgent_ChangeLocalPWD( 1143*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile* i_pProfile, 1144*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pOldPassphrase, 1145*12720SWyllys.Ingersoll@Sun.COM utf8cstr const i_pNewPassphrase); 1146*12720SWyllys.Ingersoll@Sun.COM 1147*12720SWyllys.Ingersoll@Sun.COM #define KMSAGENT_PROFILE_FLAGS uint32_t 1148*12720SWyllys.Ingersoll@Sun.COM 1149*12720SWyllys.Ingersoll@Sun.COM KMS_AGENT_STATUS 1150*12720SWyllys.Ingersoll@Sun.COM KMSAgent_GetProfileStatus( 1151*12720SWyllys.Ingersoll@Sun.COM char *i_pProfileName, 1152*12720SWyllys.Ingersoll@Sun.COM KMSAGENT_PROFILE_FLAGS *flags); 1153*12720SWyllys.Ingersoll@Sun.COM 1154*12720SWyllys.Ingersoll@Sun.COM 1155*12720SWyllys.Ingersoll@Sun.COM #define KMSAGENT_PROFILE_EXISTS_FLAG 0x01 1156*12720SWyllys.Ingersoll@Sun.COM #define KMSAGENT_CLIENTKEY_EXISTS_FLAG 0x02 1157*12720SWyllys.Ingersoll@Sun.COM #endif /* KMSUSERPKCS12 */ 1158*12720SWyllys.Ingersoll@Sun.COM 1159*12720SWyllys.Ingersoll@Sun.COM #ifdef __cplusplus 1160*12720SWyllys.Ingersoll@Sun.COM } 1161*12720SWyllys.Ingersoll@Sun.COM #endif 1162*12720SWyllys.Ingersoll@Sun.COM 1163*12720SWyllys.Ingersoll@Sun.COM #endif 1164