Esempio n. 1
0
        public async ValueTask <IResponse> ProcessContAuthResponseAsync(IXdrReader xdr, CancellationToken cancellationToken = default)
        {
            var operation = await xdr.ReadOperationAsync(cancellationToken).ConfigureAwait(false);

            var response = await GdsConnection.ProcessOperationAsync(operation, xdr, cancellationToken).ConfigureAwait(false);

            GdsConnection.HandleResponseException(response);
            if (response is ContAuthResponse)
            {
                return(response);
            }
            else if (response is CryptKeyCallbackResponse)
            {
                return(response);
            }
            else if (response is GenericResponse genericResponse)
            {
                ServerKeys = genericResponse.Data;
                Complete();
            }
            else
            {
                throw new InvalidOperationException($"Unexpected response ({operation}).");
            }
            return(response);
        }
Esempio n. 2
0
        // TODO: maybe more logic can be pulled up here
        public IResponse ProcessContAuthResponse(IXdrReader xdr)
        {
            var operation = xdr.ReadOperation();
            var response  = GdsConnection.ProcessOperation(operation, xdr);

            GdsConnection.HandleResponseException(response);
            if (response is ContAuthResponse)
            {
                return(response);
            }
            else if (response is CryptKeyCallbackResponse)
            {
                return(response);
            }
            else if (response is GenericResponse genericResponse)
            {
                ServerKeys = genericResponse.Data;
                Complete();
            }
            else
            {
                throw new InvalidOperationException($"Unexpected response ({operation}).");
            }
            return(response);
        }
Esempio n. 3
0
        public async ValueTask ProcessWireCryptResponseAsync(IXdrReader xdr, GdsConnection connection, CancellationToken cancellationToken = default)
        {
            if (WireCrypt == WireCryptOption.Disabled)
            {
                return;
            }

            // after writing before reading
            connection.StartEncryption();

            var response = await GdsConnection.ProcessOperationAsync(await xdr.ReadOperationAsync(cancellationToken).ConfigureAwait(false), xdr, cancellationToken).ConfigureAwait(false);

            GdsConnection.HandleResponseException(response);

            WireCryptInitialized = true;
        }
Esempio n. 4
0
        public void ProcessWireCryptResponse(IXdrReader xdr, GdsConnection connection)
        {
            if (WireCrypt == WireCryptOption.Disabled)
            {
                return;
            }

            // after writing before reading
            connection.StartEncryption();

            var response = GdsConnection.ProcessOperation(xdr.ReadOperation(), xdr);

            GdsConnection.HandleResponseException(response);

            WireCryptInitialized = true;
        }