Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DecryptNtlm()

static int System.Net.Security.NegotiateStreamPal.DecryptNtlm ( SafeDeleteContext securityContext,
byte[] buffer,
int offset,
int count,
bool isConfidential,
out int newOffset,
uint sequenceNumber )
inlinestaticprivate

Definition at line 158 of file NegotiateStreamPal.cs.

159 {
160 if (count < 16)
161 {
162 throw new ArgumentOutOfRangeException("count");
163 }
164 TwoSecurityBuffers twoSecurityBuffers = default(TwoSecurityBuffers);
165 Span<SecurityBuffer> input = MemoryMarshal.CreateSpan(ref twoSecurityBuffers._item0, 2);
166 input[0] = new SecurityBuffer(buffer, offset, 16, SecurityBufferType.SECBUFFER_TOKEN);
167 input[1] = new SecurityBuffer(buffer, offset + 16, count - 16, SecurityBufferType.SECBUFFER_DATA);
168 SecurityBufferType securityBufferType = SecurityBufferType.SECBUFFER_DATA;
169 int num;
170 if (isConfidential)
171 {
172 num = SSPIWrapper.DecryptMessage(GlobalSSPI.SSPIAuth, securityContext, input, sequenceNumber);
173 }
174 else
175 {
176 securityBufferType |= SecurityBufferType.SECBUFFER_READONLY;
177 input[1].type = securityBufferType;
178 num = SSPIWrapper.VerifySignature(GlobalSSPI.SSPIAuth, securityContext, input, sequenceNumber);
179 }
180 if (num != 0)
181 {
182 Exception message = new Win32Exception(num);
183 if (System.Net.NetEventSource.Log.IsEnabled())
184 {
185 System.Net.NetEventSource.Error(null, message, "DecryptNtlm");
186 }
187 throw new Win32Exception(num);
188 }
189 if (input[1].type != securityBufferType)
190 {
191 throw new InternalException(input[1].type);
192 }
193 newOffset = input[1].offset;
194 return input[1].size;
195 }
static readonly System.Net.NetEventSource Log
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)

References System.Net.Security.TwoSecurityBuffers._item0, System.buffer, System.count, System.Net.SSPIWrapper.DecryptMessage(), System.Net.NetEventSource.Error(), System.input, System.Net.NetEventSource.Log, System.offset, System.Net.GlobalSSPI.SSPIAuth, System.type, and System.Net.SSPIWrapper.VerifySignature().

Referenced by System.Net.Security.NegotiateStreamPal.Decrypt().