1*12720SWyllys.Ingersoll@Sun.COM /* 2*12720SWyllys.Ingersoll@Sun.COM * CDDL HEADER START 3*12720SWyllys.Ingersoll@Sun.COM * 4*12720SWyllys.Ingersoll@Sun.COM * The contents of this file are subject to the terms of the 5*12720SWyllys.Ingersoll@Sun.COM * Common Development and Distribution License (the "License"). 6*12720SWyllys.Ingersoll@Sun.COM * You may not use this file except in compliance with the License. 7*12720SWyllys.Ingersoll@Sun.COM * 8*12720SWyllys.Ingersoll@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*12720SWyllys.Ingersoll@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*12720SWyllys.Ingersoll@Sun.COM * See the License for the specific language governing permissions 11*12720SWyllys.Ingersoll@Sun.COM * and limitations under the License. 12*12720SWyllys.Ingersoll@Sun.COM * 13*12720SWyllys.Ingersoll@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*12720SWyllys.Ingersoll@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*12720SWyllys.Ingersoll@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*12720SWyllys.Ingersoll@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*12720SWyllys.Ingersoll@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*12720SWyllys.Ingersoll@Sun.COM * 19*12720SWyllys.Ingersoll@Sun.COM * CDDL HEADER END 20*12720SWyllys.Ingersoll@Sun.COM */ 21*12720SWyllys.Ingersoll@Sun.COM 22*12720SWyllys.Ingersoll@Sun.COM /* 23*12720SWyllys.Ingersoll@Sun.COM * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 24*12720SWyllys.Ingersoll@Sun.COM */ 25*12720SWyllys.Ingersoll@Sun.COM 26*12720SWyllys.Ingersoll@Sun.COM /** 27*12720SWyllys.Ingersoll@Sun.COM * \file KMSAgentLoadBalancer.h 28*12720SWyllys.Ingersoll@Sun.COM */ 29*12720SWyllys.Ingersoll@Sun.COM 30*12720SWyllys.Ingersoll@Sun.COM #ifndef KMS_AGENT_LOAD_BALANCER_H 31*12720SWyllys.Ingersoll@Sun.COM #define KMS_AGENT_LOAD_BALANCER_H 32*12720SWyllys.Ingersoll@Sun.COM typedef char UTF8_KEYID[2*KMS_KWK_KEY_ID_SIZE+1]; 33*12720SWyllys.Ingersoll@Sun.COM 34*12720SWyllys.Ingersoll@Sun.COM class CAgentLoadBalancer 35*12720SWyllys.Ingersoll@Sun.COM { 36*12720SWyllys.Ingersoll@Sun.COM public: 37*12720SWyllys.Ingersoll@Sun.COM 38*12720SWyllys.Ingersoll@Sun.COM /** 39*12720SWyllys.Ingersoll@Sun.COM * the load balancer retains a pointer to the specified profile 40*12720SWyllys.Ingersoll@Sun.COM */ 41*12720SWyllys.Ingersoll@Sun.COM CAgentLoadBalancer( 42*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile * const i_pProfile ); 43*12720SWyllys.Ingersoll@Sun.COM 44*12720SWyllys.Ingersoll@Sun.COM ~CAgentLoadBalancer (); 45*12720SWyllys.Ingersoll@Sun.COM 46*12720SWyllys.Ingersoll@Sun.COM /** 47*12720SWyllys.Ingersoll@Sun.COM * This method must be called at the top of each agent library transaction. 48*12720SWyllys.Ingersoll@Sun.COM * Responsibilities: 49*12720SWyllys.Ingersoll@Sun.COM * <ul> 50*12720SWyllys.Ingersoll@Sun.COM * <li>clear profile failover attempts 51*12720SWyllys.Ingersoll@Sun.COM * <li>sets transaction start time 52*12720SWyllys.Ingersoll@Sun.COM * <li>performs discovery at the frequency specified in the profile 53*12720SWyllys.Ingersoll@Sun.COM * <li>maintains the status of KMAs within the cluster 54*12720SWyllys.Ingersoll@Sun.COM * </ul> 55*12720SWyllys.Ingersoll@Sun.COM * @return a random KMA from the "available" KMAs within the agent's site 56*12720SWyllys.Ingersoll@Sun.COM * or a random KMA from any of the "available" KMA's if none are available 57*12720SWyllys.Ingersoll@Sun.COM * within the agent's site. 58*12720SWyllys.Ingersoll@Sun.COM * When operating in FIPS mode then only KMAs that are 59*12720SWyllys.Ingersoll@Sun.COM * FIPS compatible will be selected, see <code>FIPScompatibleKMA</code>. 60*12720SWyllys.Ingersoll@Sun.COM * Available KMAs 61*12720SWyllys.Ingersoll@Sun.COM * are KMAs that are enabled and responding. If no FIPS compatible KMAs 62*12720SWyllys.Ingersoll@Sun.COM * are available then <code>NO_FIPS_KMA_AVAILABLE</code> is returned. 63*12720SWyllys.Ingersoll@Sun.COM * When <code>m_iClusterDiscoveryFrequency</code> is set to 0 in the profile 64*12720SWyllys.Ingersoll@Sun.COM * then load balancing and automatic discovery 65*12720SWyllys.Ingersoll@Sun.COM * are disabled so the default KMA is returned. 66*12720SWyllys.Ingersoll@Sun.COM */ 67*12720SWyllys.Ingersoll@Sun.COM int Balance(); 68*12720SWyllys.Ingersoll@Sun.COM 69*12720SWyllys.Ingersoll@Sun.COM /** 70*12720SWyllys.Ingersoll@Sun.COM * @return a KMA from the cache that has affinity with the specified DataUnitID, 71*12720SWyllys.Ingersoll@Sun.COM * if possible, otherwise return a KMA from <code>Balance</code>. See 72*12720SWyllys.Ingersoll@Sun.COM * <code>Balance</code> for <code>FIPS_MODE</code> behavior and disabled load balancing. 73*12720SWyllys.Ingersoll@Sun.COM */ 74*12720SWyllys.Ingersoll@Sun.COM int BalanceByDataUnitID( 75*12720SWyllys.Ingersoll@Sun.COM const unsigned char * const i_pDataUnitID, 76*12720SWyllys.Ingersoll@Sun.COM int i_iDataUnitIDMaxLen ); 77*12720SWyllys.Ingersoll@Sun.COM 78*12720SWyllys.Ingersoll@Sun.COM /** 79*12720SWyllys.Ingersoll@Sun.COM * @return a KMA from the cache that has affinity with the specified DataUnitKeyID, 80*12720SWyllys.Ingersoll@Sun.COM * if possible, otherwise return a KMA from <code>Balance</code>. See 81*12720SWyllys.Ingersoll@Sun.COM * <code>Balance</code> for <code>FIPS_MODE</code> behavior and disabled load balancing. 82*12720SWyllys.Ingersoll@Sun.COM */ 83*12720SWyllys.Ingersoll@Sun.COM int BalanceByDataUnitKeyID( 84*12720SWyllys.Ingersoll@Sun.COM const unsigned char * const i_pDataUnitKeyID, 85*12720SWyllys.Ingersoll@Sun.COM int i_iDataUnitKeyIDMaxLen ); 86*12720SWyllys.Ingersoll@Sun.COM 87*12720SWyllys.Ingersoll@Sun.COM enum ERRORS 88*12720SWyllys.Ingersoll@Sun.COM { 89*12720SWyllys.Ingersoll@Sun.COM CLIENT_SIDE_ERROR = -1, 90*12720SWyllys.Ingersoll@Sun.COM NO_KMA_AVAILABLE = -2, 91*12720SWyllys.Ingersoll@Sun.COM AES_KEY_UNWRAP_ERROR = -3, 92*12720SWyllys.Ingersoll@Sun.COM AES_KEY_WRAP_SETUP_ERROR = -4, 93*12720SWyllys.Ingersoll@Sun.COM NO_FIPS_KMA_AVAILABLE = -5, 94*12720SWyllys.Ingersoll@Sun.COM KWK_NOT_REGISTERED = -6 95*12720SWyllys.Ingersoll@Sun.COM }; 96*12720SWyllys.Ingersoll@Sun.COM 97*12720SWyllys.Ingersoll@Sun.COM /** 98*12720SWyllys.Ingersoll@Sun.COM * Makes a failover determination based upon soap error information and profile settings. 99*12720SWyllys.Ingersoll@Sun.COM * Responsibilities: 100*12720SWyllys.Ingersoll@Sun.COM * <ul> 101*12720SWyllys.Ingersoll@Sun.COM * <li>updates the status of the failed KMA within the profile's cluster array 102*12720SWyllys.Ingersoll@Sun.COM * <li>Client Faults - no failover, same KMA will be returned if a Server Busy error 103*12720SWyllys.Ingersoll@Sun.COM * occurred and 104*12720SWyllys.Ingersoll@Sun.COM * either the transaction timeout has not been exceeded or failover limit has not been exceeded 105*12720SWyllys.Ingersoll@Sun.COM * <li>Server Faults - a failover KMA is chosen if the limit specified set in the profile 106*12720SWyllys.Ingersoll@Sun.COM * has not been exceed 107*12720SWyllys.Ingersoll@Sun.COM * <li>For <code>CLIENT_ERROR_AGENT_KWK_NOT_REGISTERED</code> the KWK is deleted and 108*12720SWyllys.Ingersoll@Sun.COM * i_iFailedApplianceIndex is returned. The caller should re-regsiter the 109*12720SWyllys.Ingersoll@Sun.COM * KWK with this appliance. 110*12720SWyllys.Ingersoll@Sun.COM * </ul> 111*12720SWyllys.Ingersoll@Sun.COM * If all KMAs are disabled or non-responding then give up. 112*12720SWyllys.Ingersoll@Sun.COM * <li>increments profile failover attempts 113*12720SWyllys.Ingersoll@Sun.COM * </ul> 114*12720SWyllys.Ingersoll@Sun.COM * @param i_iFailedApplianceIndex the index within the profile's cluster array of the failed KMA 115*12720SWyllys.Ingersoll@Sun.COM * @param i_pstSoap the gSoap runtime from which error information can be analyzed 116*12720SWyllys.Ingersoll@Sun.COM * @return index of KMA in cluster to failover to, <code>CLIENT_SIDE_ERROR</code> to give up due to client side error, 117*12720SWyllys.Ingersoll@Sun.COM * <code>NO_KMA_AVAILABLE</code> or <code>NO_FIPS_KMA_AVAILABLE</code> if running in FIPS_MODE 118*12720SWyllys.Ingersoll@Sun.COM * if server error but no KMA to failover to 119*12720SWyllys.Ingersoll@Sun.COM */ 120*12720SWyllys.Ingersoll@Sun.COM int FailOver( 121*12720SWyllys.Ingersoll@Sun.COM int i_iFailedApplianceIndex, 122*12720SWyllys.Ingersoll@Sun.COM struct soap *i_pstSoap ); 123*12720SWyllys.Ingersoll@Sun.COM 124*12720SWyllys.Ingersoll@Sun.COM /** 125*12720SWyllys.Ingersoll@Sun.COM * Updates the response status for the specified KMA to responding. 126*12720SWyllys.Ingersoll@Sun.COM */ 127*12720SWyllys.Ingersoll@Sun.COM void UpdateResponseStatus(int i_iIndex); 128*12720SWyllys.Ingersoll@Sun.COM 129*12720SWyllys.Ingersoll@Sun.COM /** 130*12720SWyllys.Ingersoll@Sun.COM * @return HTTPS protocol URL for the KMA referenced by the specified index entry within this 131*12720SWyllys.Ingersoll@Sun.COM * object's cluster array and the specified web service port. 132*12720SWyllys.Ingersoll@Sun.COM */ 133*12720SWyllys.Ingersoll@Sun.COM char* GetHTTPSURL( 134*12720SWyllys.Ingersoll@Sun.COM int i_iIndex, 135*12720SWyllys.Ingersoll@Sun.COM int i_iPort ); 136*12720SWyllys.Ingersoll@Sun.COM /** 137*12720SWyllys.Ingersoll@Sun.COM * @return HTTP protocol URL for the KMA referenced by the specified index entry within this 138*12720SWyllys.Ingersoll@Sun.COM * object's cluster array and the specified web service port. 139*12720SWyllys.Ingersoll@Sun.COM */ 140*12720SWyllys.Ingersoll@Sun.COM char* GetHTTPURL( 141*12720SWyllys.Ingersoll@Sun.COM int i_iIndex, 142*12720SWyllys.Ingersoll@Sun.COM int i_iPort ); 143*12720SWyllys.Ingersoll@Sun.COM 144*12720SWyllys.Ingersoll@Sun.COM /** 145*12720SWyllys.Ingersoll@Sun.COM * @return the KMA IP address for the specified index entry within this object's cluster 146*12720SWyllys.Ingersoll@Sun.COM * array. 147*12720SWyllys.Ingersoll@Sun.COM */ 148*12720SWyllys.Ingersoll@Sun.COM char* GetApplianceNetworkAddress( 149*12720SWyllys.Ingersoll@Sun.COM int i_iIndex ); 150*12720SWyllys.Ingersoll@Sun.COM 151*12720SWyllys.Ingersoll@Sun.COM /** 152*12720SWyllys.Ingersoll@Sun.COM * @return the KMA ID for the specified index entry within this 153*12720SWyllys.Ingersoll@Sun.COM * object's cluster. Returns -1 if an invalid 154*12720SWyllys.Ingersoll@Sun.COM * index is provided 155*12720SWyllys.Ingersoll@Sun.COM */ 156*12720SWyllys.Ingersoll@Sun.COM Long64 GetKMAID( 157*12720SWyllys.Ingersoll@Sun.COM int i_iIndex ); 158*12720SWyllys.Ingersoll@Sun.COM 159*12720SWyllys.Ingersoll@Sun.COM /** 160*12720SWyllys.Ingersoll@Sun.COM * retrieves the KWKID for a specified KMA in the cluster. 161*12720SWyllys.Ingersoll@Sun.COM * @param i_Index element in this object's KMS cluster as returned by 162*12720SWyllys.Ingersoll@Sun.COM * one of the Balance methods or the Failover method. 163*12720SWyllys.Ingersoll@Sun.COM * @param i_lKMAID the KMAID for which a KWK is desired 164*12720SWyllys.Ingersoll@Sun.COM * @param i_pstSoap non-NULL pointer to an initialized gSoap runtime to be 165*12720SWyllys.Ingersoll@Sun.COM * used, if necessary, for KWK registration with the KMA. 166*12720SWyllys.Ingersoll@Sun.COM * @param o_pKWKID pointer to UTF8 hex character string to receive the KWKID 167*12720SWyllys.Ingersoll@Sun.COM * for the specified KMA in the cluster. 168*12720SWyllys.Ingersoll@Sun.COM * @param o_pbClientAESKeyWrapSetupError this arg gets set to true if an 169*12720SWyllys.Ingersoll@Sun.COM * error occurs that is client side related and pertaining to establishment 170*12720SWyllys.Ingersoll@Sun.COM * of the AES Key Wrapping Keys. 171*12720SWyllys.Ingersoll@Sun.COM * If the KMS cluster does not support AES KeyWrap o_pKWKID is set to 172*12720SWyllys.Ingersoll@Sun.COM * a zero-length string. A new KWK may be registered with the KMA if a value 173*12720SWyllys.Ingersoll@Sun.COM * has not yet been registered for this instance of CAgentLoadBalancer. 174*12720SWyllys.Ingersoll@Sun.COM * @return TRUE if successful and FALSE otherwise with soap fault available 175*12720SWyllys.Ingersoll@Sun.COM * in the gSoap runtime provided by the caller and io_pIndex set to 176*12720SWyllys.Ingersoll@Sun.COM * AES_KEY_WRAP_SETUP_ERROR. Use ServerError() to 177*12720SWyllys.Ingersoll@Sun.COM * determine if failover is appropriate. 178*12720SWyllys.Ingersoll@Sun.COM */ 179*12720SWyllys.Ingersoll@Sun.COM int GetKWKID( 180*12720SWyllys.Ingersoll@Sun.COM int i_Index, 181*12720SWyllys.Ingersoll@Sun.COM Long64 i_lKMAID, 182*12720SWyllys.Ingersoll@Sun.COM struct soap * const i_pstSoap, 183*12720SWyllys.Ingersoll@Sun.COM UTF8_KEYID o_pKWKID, 184*12720SWyllys.Ingersoll@Sun.COM bool * const o_pbClientAESKeyWrapSetupError); 185*12720SWyllys.Ingersoll@Sun.COM 186*12720SWyllys.Ingersoll@Sun.COM /** 187*12720SWyllys.Ingersoll@Sun.COM * performs AES Key unwrapping according to RFC3394. 188*12720SWyllys.Ingersoll@Sun.COM * @param io_pIndex Cluster index for KMA that wrapped the key. On error 189*12720SWyllys.Ingersoll@Sun.COM * the cluster index is set to AES_KEY_UNWRAP_ERROR 190*12720SWyllys.Ingersoll@Sun.COM * @param i_pAESWrappedKey pointer to the wrapped key 191*12720SWyllys.Ingersoll@Sun.COM * @param o_pPlainTextKey point to buffer to receive unwrapped key 192*12720SWyllys.Ingersoll@Sun.COM * @return true for success, false otherwise and sets *io_pIndex to 193*12720SWyllys.Ingersoll@Sun.COM * AES_KEY_UNWRAP_ERROR 194*12720SWyllys.Ingersoll@Sun.COM */ 195*12720SWyllys.Ingersoll@Sun.COM bool AESKeyUnwrap ( 196*12720SWyllys.Ingersoll@Sun.COM int * const io_pIndex, 197*12720SWyllys.Ingersoll@Sun.COM const WRAPPED_KEY i_pAESWrappedKey, 198*12720SWyllys.Ingersoll@Sun.COM KEY o_pPlainTextKey ); 199*12720SWyllys.Ingersoll@Sun.COM 200*12720SWyllys.Ingersoll@Sun.COM /** 201*12720SWyllys.Ingersoll@Sun.COM * @return true if the KMA referenced by the specified cluster 202*12720SWyllys.Ingersoll@Sun.COM * index supports AES key wrap 203*12720SWyllys.Ingersoll@Sun.COM */ 204*12720SWyllys.Ingersoll@Sun.COM bool AESKeyWrapSupported ( 205*12720SWyllys.Ingersoll@Sun.COM int i_iIndex); 206*12720SWyllys.Ingersoll@Sun.COM 207*12720SWyllys.Ingersoll@Sun.COM protected: 208*12720SWyllys.Ingersoll@Sun.COM /** 209*12720SWyllys.Ingersoll@Sun.COM * @return the cluster array index of the KMA with the specified IP address 210*12720SWyllys.Ingersoll@Sun.COM * or CLIENT_SIDE_ERROR if the KMA is not responding or not enabled 211*12720SWyllys.Ingersoll@Sun.COM */ 212*12720SWyllys.Ingersoll@Sun.COM int FindIndexByNetworkAddress ( 213*12720SWyllys.Ingersoll@Sun.COM char* i_wsApplianceNetworkAddress); 214*12720SWyllys.Ingersoll@Sun.COM 215*12720SWyllys.Ingersoll@Sun.COM private: 216*12720SWyllys.Ingersoll@Sun.COM 217*12720SWyllys.Ingersoll@Sun.COM /** 218*12720SWyllys.Ingersoll@Sun.COM * Sorts the cluster array ascending by load. 219*12720SWyllys.Ingersoll@Sun.COM * Before sorting, the other site's KMAs' load are added by 0x10000000000 and 220*12720SWyllys.Ingersoll@Sun.COM * the disabled/non-responding/locked KMAs are added by 0x1000000000000 and KMAs 221*12720SWyllys.Ingersoll@Sun.COM * not matching the agent's FIPS setting the load is bumped by 0x100000000000000. 222*12720SWyllys.Ingersoll@Sun.COM * This ensures that KMAs 223*12720SWyllys.Ingersoll@Sun.COM * in the current site are sorted before KMAs in other sites and 224*12720SWyllys.Ingersoll@Sun.COM * disabled/non-responding/locked KMAs are after those enabled KMAs. When the agent is 225*12720SWyllys.Ingersoll@Sun.COM * in FIPS mode the non-FIPS KMAs are sorted last. 226*12720SWyllys.Ingersoll@Sun.COM */ 227*12720SWyllys.Ingersoll@Sun.COM void KMSClient_SortClusterArray ( 228*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile * const i_pProfile); 229*12720SWyllys.Ingersoll@Sun.COM 230*12720SWyllys.Ingersoll@Sun.COM static const int MAX_RSA_PUB_KEY_LENGTH = 256; 231*12720SWyllys.Ingersoll@Sun.COM int m_iClusterNum; 232*12720SWyllys.Ingersoll@Sun.COM 233*12720SWyllys.Ingersoll@Sun.COM /** 234*12720SWyllys.Ingersoll@Sun.COM * this array is reinitialized from the profile's Cluster array each time Balance() is called. 235*12720SWyllys.Ingersoll@Sun.COM * Failover() will resort the profile's Cluster array so this array may not 236*12720SWyllys.Ingersoll@Sun.COM * match the sort order in the profile 237*12720SWyllys.Ingersoll@Sun.COM */ 238*12720SWyllys.Ingersoll@Sun.COM KMSClusterEntry m_aCluster[KMS_MAX_CLUSTER_NUM]; 239*12720SWyllys.Ingersoll@Sun.COM KMSClientProfile *m_pProfile; 240*12720SWyllys.Ingersoll@Sun.COM char m_sURL[KMS_MAX_URL+1]; 241*12720SWyllys.Ingersoll@Sun.COM unsigned int m_iTransactionStartTimeInMilliseconds; 242*12720SWyllys.Ingersoll@Sun.COM bool m_bFIPS; 243*12720SWyllys.Ingersoll@Sun.COM 244*12720SWyllys.Ingersoll@Sun.COM /** 245*12720SWyllys.Ingersoll@Sun.COM * number of elements in KWKEntries 246*12720SWyllys.Ingersoll@Sun.COM */ 247*12720SWyllys.Ingersoll@Sun.COM int m_iKWKEntryNum; 248*12720SWyllys.Ingersoll@Sun.COM 249*12720SWyllys.Ingersoll@Sun.COM /** 250*12720SWyllys.Ingersoll@Sun.COM * in a failover scenario, if all KMAs are not responding this 251*12720SWyllys.Ingersoll@Sun.COM * member variable tracks the index into m_aCluster of the last KMA attempted. 252*12720SWyllys.Ingersoll@Sun.COM */ 253*12720SWyllys.Ingersoll@Sun.COM int m_iLastAttemptedWhenNoneResponding; 254*12720SWyllys.Ingersoll@Sun.COM 255*12720SWyllys.Ingersoll@Sun.COM /** 256*12720SWyllys.Ingersoll@Sun.COM * @return true if the failover limit has been exceeded. If failover 257*12720SWyllys.Ingersoll@Sun.COM * limit of -1 is specified in the profile then always return false. 258*12720SWyllys.Ingersoll@Sun.COM */ 259*12720SWyllys.Ingersoll@Sun.COM bool FailOverLimit(void); 260*12720SWyllys.Ingersoll@Sun.COM 261*12720SWyllys.Ingersoll@Sun.COM /** 262*12720SWyllys.Ingersoll@Sun.COM * \struct for each KMA used in a profile session there will be 263*12720SWyllys.Ingersoll@Sun.COM * a KWKEntry in KWKEntries. These values do not persist 264*12720SWyllys.Ingersoll@Sun.COM * beyond a profile session 265*12720SWyllys.Ingersoll@Sun.COM */ 266*12720SWyllys.Ingersoll@Sun.COM struct KWKEntry 267*12720SWyllys.Ingersoll@Sun.COM { 268*12720SWyllys.Ingersoll@Sun.COM /** 269*12720SWyllys.Ingersoll@Sun.COM * The KMA associated with this KWK. This KMA 270*12720SWyllys.Ingersoll@Sun.COM * receives the KWK via the KMS_Agent__RegisterAgentKWK() 271*12720SWyllys.Ingersoll@Sun.COM * agent service which returns the KMA assigned value for 272*12720SWyllys.Ingersoll@Sun.COM * m_acKWKID 273*12720SWyllys.Ingersoll@Sun.COM */ 274*12720SWyllys.Ingersoll@Sun.COM Long64 m_lKMAID; 275*12720SWyllys.Ingersoll@Sun.COM 276*12720SWyllys.Ingersoll@Sun.COM /** 277*12720SWyllys.Ingersoll@Sun.COM * the KeyID for this KWK, provided by the KMA 278*12720SWyllys.Ingersoll@Sun.COM */ 279*12720SWyllys.Ingersoll@Sun.COM UTF8_KEYID m_acKWKID; 280*12720SWyllys.Ingersoll@Sun.COM 281*12720SWyllys.Ingersoll@Sun.COM /** 282*12720SWyllys.Ingersoll@Sun.COM * the plaintext value of the AES KWK 283*12720SWyllys.Ingersoll@Sun.COM */ 284*12720SWyllys.Ingersoll@Sun.COM KEY m_acKWK; 285*12720SWyllys.Ingersoll@Sun.COM }; 286*12720SWyllys.Ingersoll@Sun.COM 287*12720SWyllys.Ingersoll@Sun.COM /** 288*12720SWyllys.Ingersoll@Sun.COM * set of KWKEntry ptrs for KMAs used in this profile session. 289*12720SWyllys.Ingersoll@Sun.COM */ 290*12720SWyllys.Ingersoll@Sun.COM struct KWKEntry * m_aKWKEntries[KMS_MAX_CLUSTER_NUM]; 291*12720SWyllys.Ingersoll@Sun.COM 292*12720SWyllys.Ingersoll@Sun.COM /** 293*12720SWyllys.Ingersoll@Sun.COM * retrieve the Key Wrapping Key for a KMA 294*12720SWyllys.Ingersoll@Sun.COM * @param i_lKMAID KMA identifier, must not be equal to -1 295*12720SWyllys.Ingersoll@Sun.COM * @return pointer to the KWKEntry for the specified KMAID, NULL 296*12720SWyllys.Ingersoll@Sun.COM * if the entry does not exist 297*12720SWyllys.Ingersoll@Sun.COM */ 298*12720SWyllys.Ingersoll@Sun.COM struct KWKEntry *GetKWK( 299*12720SWyllys.Ingersoll@Sun.COM Long64 i_lKMAID ); 300*12720SWyllys.Ingersoll@Sun.COM 301*12720SWyllys.Ingersoll@Sun.COM /** 302*12720SWyllys.Ingersoll@Sun.COM * creates a new KWKEntry on the heap and store a ptr to it in an 303*12720SWyllys.Ingersoll@Sun.COM * unused slot in <code>m_aKWKEntries</code>. 304*12720SWyllys.Ingersoll@Sun.COM * @return NULL on error, otherwise a pointer to the newly 305*12720SWyllys.Ingersoll@Sun.COM * created KWKEntry 306*12720SWyllys.Ingersoll@Sun.COM */ 307*12720SWyllys.Ingersoll@Sun.COM struct KWKEntry *CreateKWK( 308*12720SWyllys.Ingersoll@Sun.COM Long64 i_lKMAID, 309*12720SWyllys.Ingersoll@Sun.COM struct soap * const i_pstSoap, 310*12720SWyllys.Ingersoll@Sun.COM const char * const i_sURL, 311*12720SWyllys.Ingersoll@Sun.COM bool * const o_pbClientAESKeyWrapSetupError); 312*12720SWyllys.Ingersoll@Sun.COM 313*12720SWyllys.Ingersoll@Sun.COM /** 314*12720SWyllys.Ingersoll@Sun.COM * free the <code>KWKEntry</code> corresponding to the specified KMA ID 315*12720SWyllys.Ingersoll@Sun.COM * and set the slot it occupied in <code>m_aKWKEntries</code> to NULL. 316*12720SWyllys.Ingersoll@Sun.COM */ 317*12720SWyllys.Ingersoll@Sun.COM void DeleteKWKEntry(Long64 i_lKMAID); 318*12720SWyllys.Ingersoll@Sun.COM 319*12720SWyllys.Ingersoll@Sun.COM /** 320*12720SWyllys.Ingersoll@Sun.COM * retrieve the RSA public key to be used for wrapping a KWK 321*12720SWyllys.Ingersoll@Sun.COM */ 322*12720SWyllys.Ingersoll@Sun.COM int GetKWKWrappingKey( 323*12720SWyllys.Ingersoll@Sun.COM struct soap * const i_pstSoap, 324*12720SWyllys.Ingersoll@Sun.COM const char * const i_sURL, 325*12720SWyllys.Ingersoll@Sun.COM CPublicKey * const o_opPublicKEK ); 326*12720SWyllys.Ingersoll@Sun.COM 327*12720SWyllys.Ingersoll@Sun.COM /** 328*12720SWyllys.Ingersoll@Sun.COM * register the KWK with a specified KMA and return the KWK ID 329*12720SWyllys.Ingersoll@Sun.COM */ 330*12720SWyllys.Ingersoll@Sun.COM int RegisterKWK( 331*12720SWyllys.Ingersoll@Sun.COM int i_iWrappedKWKSize, 332*12720SWyllys.Ingersoll@Sun.COM const unsigned char * const i_acWrappedKWK, 333*12720SWyllys.Ingersoll@Sun.COM struct soap * const i_pstSoap, 334*12720SWyllys.Ingersoll@Sun.COM const char * const i_sURL, 335*12720SWyllys.Ingersoll@Sun.COM UTF8_KEYID o_acUTF8KeyID ); 336*12720SWyllys.Ingersoll@Sun.COM 337*12720SWyllys.Ingersoll@Sun.COM }; 338*12720SWyllys.Ingersoll@Sun.COM 339*12720SWyllys.Ingersoll@Sun.COM #endif //KMS_AGENT_LOAD_BALANCER_H 340