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

◆ DecryptMessage()

static unsafe SecurityStatusPal System.Net.Security.SslStreamPal.DecryptMessage ( SafeDeleteSslContext securityContext,
Span< byte > buffer,
out int offset,
out int count )
inlinestatic

Definition at line 245 of file SslStreamPal.cs.

246 {
247 fixed (byte* ptr3 = buffer)
248 {
249 global::Interop.SspiCli.SecBuffer* ptr = stackalloc global::Interop.SspiCli.SecBuffer[4];
250 global::Interop.SspiCli.SecBuffer* ptr2 = ptr;
251 ptr2->BufferType = SecurityBufferType.SECBUFFER_DATA;
252 ptr2->pvBuffer = (IntPtr)ptr3;
253 ptr2->cbBuffer = buffer.Length;
254 for (int i = 1; i < 4; i++)
255 {
256 global::Interop.SspiCli.SecBuffer* ptr4 = ptr + i;
257 ptr4->BufferType = SecurityBufferType.SECBUFFER_EMPTY;
258 ptr4->pvBuffer = IntPtr.Zero;
259 ptr4->cbBuffer = 0;
260 }
261 global::Interop.SspiCli.SecBufferDesc secBufferDesc = new global::Interop.SspiCli.SecBufferDesc(4);
262 secBufferDesc.pBuffers = ptr;
263 global::Interop.SspiCli.SecBufferDesc inputOutput = secBufferDesc;
264 global::Interop.SECURITY_STATUS sECURITY_STATUS = (global::Interop.SECURITY_STATUS)GlobalSSPI.SSPISecureChannel.DecryptMessage(securityContext, ref inputOutput, 0u);
265 count = 0;
266 offset = 0;
267 for (int j = 0; j < 4; j++)
268 {
269 if ((sECURITY_STATUS == global::Interop.SECURITY_STATUS.OK && ptr[j].BufferType == SecurityBufferType.SECBUFFER_DATA) || (sECURITY_STATUS != 0 && ptr[j].BufferType == SecurityBufferType.SECBUFFER_EXTRA))
270 {
271 offset = (int)((byte*)(void*)ptr[j].pvBuffer - ptr3);
272 count = ptr[j].cbBuffer;
273 break;
274 }
275 }
276 return SecurityStatusAdapterPal.GetSecurityStatusPalFromInterop(sECURITY_STATUS);
277 }
278 }

References System.buffer, System.count, System.Net.SecurityStatusAdapterPal.GetSecurityStatusPalFromInterop(), System.offset, System.Net.GlobalSSPI.SSPISecureChannel, and System.IntPtr.Zero.

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