public override void Attach(DatabaseParameterBufferBase dpb, string database, byte[] cryptKey) { try { SendAttachToBuffer(dpb, database); Xdr.Flush(); var response = ReadResponse(); if (response is ContAuthResponse) { while (response is ContAuthResponse contAuthResponse) { AuthBlock.Start(contAuthResponse.ServerData, contAuthResponse.AcceptPluginName, contAuthResponse.IsAuthenticated, contAuthResponse.ServerKeys); AuthBlock.SendContAuthToBuffer(Xdr); Xdr.Flush(); response = AuthBlock.ProcessContAuthResponse(Xdr); response = ProcessCryptCallbackResponseIfNeeded(response, cryptKey); } var genericResponse = (GenericResponse)response; ProcessAttachResponse(genericResponse); if (genericResponse.Data.Any()) { AuthBlock.SendWireCryptToBuffer(Xdr); Xdr.Flush(); AuthBlock.ProcessWireCryptResponse(Xdr, _connection); } } else { response = ProcessCryptCallbackResponseIfNeeded(response, cryptKey); ProcessAttachResponse((GenericResponse)response); AuthBlock.Complete(); } AuthBlock.WireCryptValidate(IscCodes.PROTOCOL_VERSION13); } catch (IscException) { SafelyDetach(); throw; } catch (IOException ex) { SafelyDetach(); throw IscException.ForIOException(ex); } AfterAttachActions(); }
public override void CreateDatabase(DatabaseParameterBufferBase dpb, string database, byte[] cryptKey) { try { SendCreateToBuffer(dpb, database); Xdr.Flush(); var response = ReadResponse(); if (response is ContAuthResponse) { while (response is ContAuthResponse contAuthResponse) { AuthBlock.Start(contAuthResponse.ServerData, contAuthResponse.AcceptPluginName, contAuthResponse.IsAuthenticated, contAuthResponse.ServerKeys); AuthBlock.SendContAuthToBuffer(); Xdr.Flush(); response = AuthBlock.ProcessContAuthResponse(); response = ProcessCryptCallbackResponseIfNeeded(response, cryptKey); } var genericResponse = (GenericResponse)response; ProcessCreateResponse(genericResponse); if (genericResponse.Data.Any()) { AuthBlock.SendWireCryptToBuffer(); Xdr.Flush(); AuthBlock.ProcessWireCryptResponse(); } } else { response = ProcessCryptCallbackResponseIfNeeded(response, cryptKey); ProcessCreateResponse((GenericResponse)response); AuthBlock.Complete(); } } catch (IOException ex) { throw IscException.ForIOException(ex); } }