/// <summary> /// Create a new enclave session /// </summary> /// <param name="attestationProtocol">attestation protocol</param> /// <param name="enclaveType">enclave type</param> /// <param name="serverName">servername</param> /// <param name="attestationUrl">attestation url for attestation service endpoint</param> /// <param name="attestationInfo">attestation info from SQL Server</param> /// <param name="attestationParameters">attestation parameters</param> /// <param name="customData">A set of extra data needed for attestating the enclave.</param> /// <param name="customDataLength">The length of the extra data needed for attestating the enclave.</param> internal void CreateEnclaveSession(SqlConnectionAttestationProtocol attestationProtocol, string enclaveType, string serverName, string attestationUrl, byte[] attestationInfo, SqlEnclaveAttestationParameters attestationParameters, byte[] customData, int customDataLength) { lock (_lock) { SqlColumnEncryptionEnclaveProvider sqlColumnEncryptionEnclaveProvider = GetEnclaveProvider(attestationProtocol, enclaveType); long counter; SqlEnclaveSession sqlEnclaveSession = null; byte[] dummyCustomData = null; int dummyCustomDataLength; sqlColumnEncryptionEnclaveProvider.GetEnclaveSession(serverName, attestationUrl, false, out sqlEnclaveSession, out counter, out dummyCustomData, out dummyCustomDataLength); if (sqlEnclaveSession != null) { return; } sqlColumnEncryptionEnclaveProvider.CreateEnclaveSession(attestationInfo, attestationParameters.ClientDiffieHellmanKey, attestationUrl, serverName, customData, customDataLength, out sqlEnclaveSession, out counter); if (sqlEnclaveSession == null) { throw SQL.NullEnclaveSessionReturnedFromProvider(enclaveType, attestationUrl); } } }
private void GetEnclaveSession(SqlConnectionAttestationProtocol attestationProtocol, string enclaveType, EnclaveSessionParameters enclaveSessionParameters, bool generateCustomData, out SqlEnclaveSession sqlEnclaveSession, out long counter, out byte[] customData, out int customDataLength, bool throwIfNull) { SqlColumnEncryptionEnclaveProvider sqlColumnEncryptionEnclaveProvider = GetEnclaveProvider(attestationProtocol, enclaveType); sqlColumnEncryptionEnclaveProvider.GetEnclaveSession(enclaveSessionParameters, generateCustomData, out sqlEnclaveSession, out counter, out customData, out customDataLength); if (throwIfNull && sqlEnclaveSession == null) { throw SQL.NullEnclaveSessionDuringQueryExecution(enclaveType, enclaveSessionParameters.AttestationUrl); } }
private void GetEnclaveSession(SqlConnectionAttestationProtocol attestationProtocol, string enclaveType, string serverName, string enclaveAttestationUrl, out SqlEnclaveSession sqlEnclaveSession, out long counter, bool throwIfNull) { SqlColumnEncryptionEnclaveProvider sqlColumnEncryptionEnclaveProvider = GetEnclaveProvider(attestationProtocol, enclaveType); sqlColumnEncryptionEnclaveProvider.GetEnclaveSession(serverName, enclaveAttestationUrl, out sqlEnclaveSession, out counter); if (throwIfNull && sqlEnclaveSession == null) { throw SQL.NullEnclaveSessionDuringQueryExecution(enclaveType, enclaveAttestationUrl); } }
/// <summary> /// Create a new enclave session /// </summary> /// <param name="enclaveType">enclave type</param> /// <param name="serverName">servername</param> /// <param name="attestationUrl">attestation url for attestation service endpoint</param> /// <param name="attestationInfo">attestation info from SQL Server</param> /// <param name="attestationParameters">attestation parameters</param> internal void CreateEnclaveSession(string enclaveType, string serverName, string attestationUrl, byte[] attestationInfo, SqlEnclaveAttestationParameters attestationParameters) { lock (_lock) { SqlColumnEncryptionEnclaveProvider sqlColumnEncryptionEnclaveProvider = GetEnclaveProvider(enclaveType); long counter; SqlEnclaveSession sqlEnclaveSession = null; sqlColumnEncryptionEnclaveProvider.GetEnclaveSession(serverName, attestationUrl, out sqlEnclaveSession, out counter); if (sqlEnclaveSession != null) { return; } sqlColumnEncryptionEnclaveProvider.CreateEnclaveSession(attestationInfo, attestationParameters.ClientDiffieHellmanKey, attestationUrl, serverName, out sqlEnclaveSession, out counter); if (sqlEnclaveSession == null) { throw SQL.NullEnclaveSessionReturnedFromProvider(enclaveType, attestationUrl); } } }
/// <summary> /// Create a new enclave session /// </summary> /// <param name="attestationProtocol">attestation protocol</param> /// <param name="enclaveType">enclave type</param> /// <param name="enclaveSessionParameters">The set of parameters required for enclave session.</param> /// <param name="attestationInfo">attestation info from SQL Server</param> /// <param name="attestationParameters">attestation parameters</param> /// <param name="customData">A set of extra data needed for attestating the enclave.</param> /// <param name="customDataLength">The length of the extra data needed for attestating the enclave.</param> internal void CreateEnclaveSession(SqlConnectionAttestationProtocol attestationProtocol, string enclaveType, EnclaveSessionParameters enclaveSessionParameters, byte[] attestationInfo, SqlEnclaveAttestationParameters attestationParameters, byte[] customData, int customDataLength) { lock (_lock) { SqlColumnEncryptionEnclaveProvider sqlColumnEncryptionEnclaveProvider = GetEnclaveProvider(attestationProtocol, enclaveType); sqlColumnEncryptionEnclaveProvider.GetEnclaveSession( enclaveSessionParameters, generateCustomData: false, sqlEnclaveSession: out SqlEnclaveSession sqlEnclaveSession, counter: out _, customData: out _, customDataLength: out _ ); if (sqlEnclaveSession != null) { return; } sqlColumnEncryptionEnclaveProvider.CreateEnclaveSession( attestationInfo, attestationParameters.ClientDiffieHellmanKey, enclaveSessionParameters, customData, customDataLength, out sqlEnclaveSession, counter: out _ ); if (sqlEnclaveSession == null) { throw SQL.NullEnclaveSessionReturnedFromProvider(enclaveType, enclaveSessionParameters.AttestationUrl); } } }