private SqlColumnEncryptionEnclaveProvider GetEnclaveProvider(SqlConnectionAttestationProtocol attestationProtocol, string enclaveType) { SqlColumnEncryptionEnclaveProvider sqlColumnEncryptionEnclaveProvider = null; if (!EnclaveProviders.TryGetValue(attestationProtocol, out sqlColumnEncryptionEnclaveProvider)) { switch (attestationProtocol) { case SqlConnectionAttestationProtocol.AAS: AzureAttestationEnclaveProvider azureAttestationEnclaveProvider = new AzureAttestationEnclaveProvider(); EnclaveProviders[attestationProtocol] = (SqlColumnEncryptionEnclaveProvider)azureAttestationEnclaveProvider; sqlColumnEncryptionEnclaveProvider = EnclaveProviders[attestationProtocol]; break; case SqlConnectionAttestationProtocol.HGS: HostGuardianServiceEnclaveProvider hostGuardianServiceEnclaveProvider = new HostGuardianServiceEnclaveProvider(); EnclaveProviders[attestationProtocol] = (SqlColumnEncryptionEnclaveProvider)hostGuardianServiceEnclaveProvider; sqlColumnEncryptionEnclaveProvider = EnclaveProviders[attestationProtocol]; break; default: break; } } if (sqlColumnEncryptionEnclaveProvider == null) { throw SQL.EnclaveProviderNotFound(enclaveType, ConvertAttestationProtocolToString(attestationProtocol)); } return(sqlColumnEncryptionEnclaveProvider); }
private SqlColumnEncryptionEnclaveProvider GetEnclaveProvider(SqlConnectionAttestationProtocol attestationProtocol, string enclaveType) { if (!s_enclaveProviders.TryGetValue(attestationProtocol, out SqlColumnEncryptionEnclaveProvider sqlColumnEncryptionEnclaveProvider)) { switch (attestationProtocol) { case SqlConnectionAttestationProtocol.AAS: AzureAttestationEnclaveProvider azureAttestationEnclaveProvider = new AzureAttestationEnclaveProvider(); s_enclaveProviders[attestationProtocol] = azureAttestationEnclaveProvider; sqlColumnEncryptionEnclaveProvider = s_enclaveProviders[attestationProtocol]; break; case SqlConnectionAttestationProtocol.HGS: HostGuardianServiceEnclaveProvider hostGuardianServiceEnclaveProvider = new HostGuardianServiceEnclaveProvider(); s_enclaveProviders[attestationProtocol] = hostGuardianServiceEnclaveProvider; sqlColumnEncryptionEnclaveProvider = s_enclaveProviders[attestationProtocol]; break; #if ENCLAVE_SIMULATOR case SqlConnectionAttestationProtocol.SIM: SimulatorEnclaveProvider simulatorEnclaveProvider = new SimulatorEnclaveProvider(); s_enclaveProviders[attestationProtocol] = (SqlColumnEncryptionEnclaveProvider)simulatorEnclaveProvider; sqlColumnEncryptionEnclaveProvider = s_enclaveProviders[attestationProtocol]; break; #endif default: break; } } if (sqlColumnEncryptionEnclaveProvider == null) { throw SQL.EnclaveProviderNotFound(enclaveType, ConvertAttestationProtocolToString(attestationProtocol)); } return(sqlColumnEncryptionEnclaveProvider); }