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

◆ GetOutgoingBlob() [2/7]

byte[] System.Net.NTAuthentication.GetOutgoingBlob ( byte[] incomingBlob,
bool throwOnError,
out SecurityStatusPal statusCode )
inlinepackage

Definition at line 207 of file NTAuthentication.cs.

208 {
209 byte[] resultBlob = new byte[_tokenSize];
210 bool flag = _securityContext == null;
211 try
212 {
213 if (!_isServer)
214 {
216 if (System.Net.NetEventSource.Log.IsEnabled())
217 {
218 System.Net.NetEventSource.Info(this, $"SSPIWrapper.InitializeSecurityContext() returns statusCode:0x{(int)statusCode.ErrorCode:x8} ({statusCode})", "GetOutgoingBlob");
219 }
220 if (statusCode.ErrorCode == SecurityStatusPalErrorCode.CompleteNeeded)
221 {
222 statusCode = NegotiateStreamPal.CompleteAuthToken(ref _securityContext, resultBlob);
223 if (System.Net.NetEventSource.Log.IsEnabled())
224 {
225 System.Net.NetEventSource.Info(this, $"SSPIWrapper.CompleteAuthToken() returns statusCode:0x{(int)statusCode.ErrorCode:x8} ({statusCode})", "GetOutgoingBlob");
226 }
227 resultBlob = null;
228 }
229 }
230 else
231 {
233 if (System.Net.NetEventSource.Log.IsEnabled())
234 {
235 System.Net.NetEventSource.Info(this, $"SSPIWrapper.AcceptSecurityContext() returns statusCode:0x{(int)statusCode.ErrorCode:x8} ({statusCode})", "GetOutgoingBlob");
236 }
237 }
238 }
239 finally
240 {
241 if (flag)
242 {
243 _credentialsHandle?.Dispose();
244 }
245 }
246 if (statusCode.ErrorCode >= SecurityStatusPalErrorCode.OutOfMemory)
247 {
248 CloseContext();
249 _isCompleted = true;
250 if (throwOnError)
251 {
253 }
254 return null;
255 }
256 if (flag && _credentialsHandle != null)
257 {
259 }
260 if (statusCode.ErrorCode == SecurityStatusPalErrorCode.OK || (_isServer && statusCode.ErrorCode == SecurityStatusPalErrorCode.CompleteNeeded))
261 {
262 _isCompleted = true;
263 }
264 else if (System.Net.NetEventSource.Log.IsEnabled())
265 {
266 System.Net.NetEventSource.Info(this, $"need continue statusCode:0x{(int)statusCode.ErrorCode:x8} ({statusCode}) _securityContext:{_securityContext}", "GetOutgoingBlob");
267 }
268 return resultBlob;
269 }
System.Net.ContextFlagsPal _contextFlags
System.Net.Security.SafeFreeCredentials _credentialsHandle
System.Net.ContextFlagsPal _requestedContextFlags
System.Net.Security.SafeDeleteContext _securityContext
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static System.Net.SecurityStatusPal AcceptSecurityContext(System.Net.Security.SafeFreeCredentials credentialsHandle, ref System.Net.Security.SafeDeleteContext securityContext, System.Net.ContextFlagsPal requestedContextFlags, byte[] incomingBlob, ChannelBinding channelBinding, ref byte[] resultBlob, ref System.Net.ContextFlagsPal contextFlags)
static System.Net.SecurityStatusPal InitializeSecurityContext(ref System.Net.Security.SafeFreeCredentials credentialsHandle, ref System.Net.Security.SafeDeleteContext securityContext, string spn, System.Net.ContextFlagsPal requestedContextFlags, byte[] incomingBlob, ChannelBinding channelBinding, ref byte[] resultBlob, ref System.Net.ContextFlagsPal contextFlags)
static System.Net.SecurityStatusPal CompleteAuthToken(ref System.Net.Security.SafeDeleteContext securityContext, byte[] incomingBlob)
static Win32Exception CreateExceptionFromError(System.Net.SecurityStatusPal statusCode)
static void CacheCredential(System.Net.Security.SafeFreeCredentials newHandle)

References System.Net.NTAuthentication._channelBinding, System.Net.NTAuthentication._contextFlags, System.Net.NTAuthentication._credentialsHandle, System.Net.NTAuthentication._isCompleted, System.Net.NTAuthentication._isServer, System.Net.NTAuthentication._requestedContextFlags, System.Net.NTAuthentication._securityContext, System.Net.NTAuthentication._spn, System.Net.NTAuthentication._tokenSize, System.Net.Security.NegotiateStreamPal.AcceptSecurityContext(), System.Net.Security.SSPIHandleCache.CacheCredential(), System.Net.NTAuthentication.CloseContext(), System.Net.Security.NegotiateStreamPal.CompleteAuthToken(), System.Net.Security.NegotiateStreamPal.CreateExceptionFromError(), System.Net.NetEventSource.Info(), System.Net.Security.NegotiateStreamPal.InitializeSecurityContext(), and System.Net.NetEventSource.Log.