bool xEncrypt(ref DJsIO xNewPayload) { try { if (!xSuccess) { return(false); } if (xIsLive) { byte[] xService = (ThisType == AccountType.Stock ? new byte[] { 0x50, 0x52, 0x4F, 0x44 } : // PROD new byte[] { 0x50, 0x41, 0x53, 0x54 }); // PART xNewPayload.Position = 0x34; xNewPayload.Write(xService); xNewPayload.Flush(); } List <byte> xReturn = new List <byte>(); byte[] xConfounder = xRC4.NewConfounder(8); byte[] NewPay = xNewPayload.ReadStream(); xNewPayload.Dispose(); byte[] xHeaderKey = xComputeHeaderKey(xConfounder, NewPay); xRC4.KeyBinary = xComputeRC4Key(xHeaderKey); xReturn.AddRange(xHeaderKey); xReturn.AddRange(xRC4.KerberosEncrypt(ref xConfounder, ref NewPay)); IO.Position = 0; IO.Write(xReturn.ToArray()); IO.Flush(); return(true); } catch { return(false); } }