public override void Attach(DatabaseParameterBuffer dpb, string dataSource, int port, string database, byte[] cryptKey) { try { SendAttachToBuffer(dpb, database); XdrStream.Flush(); var response = ReadResponse(); while (response is CryptKeyCallbackReponse cryptResponse) { XdrStream.Write(IscCodes.op_crypt_key_callback); XdrStream.WriteBuffer(cryptKey); XdrStream.Flush(); response = ReadResponse(); } ProcessAttachResponse(response as GenericResponse); } catch (IscException) { SafelyDetach(); throw; } catch (IOException ex) { SafelyDetach(); throw IscException.ForErrorCode(IscCodes.isc_net_write_err, ex); } AfterAttachActions(); }
protected void ProcessTrustedAuthResponse(SspiHelper sspiHelper, ref IResponse response) { while (response is AuthResponse) { byte[] authData = sspiHelper.GetClientSecurity(((AuthResponse)response).Data); XdrStream.Write(IscCodes.op_trusted_auth); XdrStream.WriteBuffer(authData); XdrStream.Flush(); response = ReadResponse(); } }
public IResponse ProcessCryptCallbackResponseIfNeeded(IResponse response, byte[] cryptKey) { while (response is CryptKeyCallbackResponse cryptResponse) { XdrStream.Write(IscCodes.op_crypt_key_callback); XdrStream.WriteBuffer(cryptKey); XdrStream.Flush(); response = ReadResponse(); } return(response); }
protected override void SendCreateToBuffer(DatabaseParameterBuffer dpb, string database) { XdrStream.Write(IscCodes.op_create); XdrStream.Write(0); if (AuthData != null) { dpb.Append(IscCodes.isc_dpb_specific_auth_data, AuthData); } dpb.Append(IscCodes.isc_dpb_utf8_filename, 0); XdrStream.WriteBuffer(Encoding.UTF8.GetBytes(database)); XdrStream.WriteBuffer(dpb.ToArray()); }
protected override void SendCreateToBuffer(DatabaseParameterBuffer dpb, string database) { XdrStream.Write(IscCodes.op_create); XdrStream.Write(0); if (!string.IsNullOrEmpty(Password)) { dpb.Append(IscCodes.isc_dpb_password, Password); } dpb.Append(IscCodes.isc_dpb_utf8_filename, 0); XdrStream.WriteBuffer(Encoding.UTF8.GetBytes(database)); XdrStream.WriteBuffer(dpb.ToArray()); }