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

◆ Decrypt()

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

Definition at line 122 of file NegotiateStreamPal.cs.

123 {
124 if (offset < 0 || offset > ((buffer != null) ? buffer.Length : 0))
125 {
126 throw new ArgumentOutOfRangeException("offset");
127 }
128 if (count < 0 || count > ((buffer != null) ? (buffer.Length - offset) : 0))
129 {
130 throw new ArgumentOutOfRangeException("count");
131 }
132 if (isNtlm)
133 {
134 return DecryptNtlm(securityContext, buffer, offset, count, isConfidential, out newOffset, sequenceNumber);
135 }
136 TwoSecurityBuffers twoSecurityBuffers = default(TwoSecurityBuffers);
137 Span<SecurityBuffer> input = MemoryMarshal.CreateSpan(ref twoSecurityBuffers._item0, 2);
138 input[0] = new SecurityBuffer(buffer, offset, count, SecurityBufferType.SECBUFFER_STREAM);
139 input[1] = new SecurityBuffer(0, SecurityBufferType.SECBUFFER_DATA);
140 int num = ((!isConfidential) ? SSPIWrapper.VerifySignature(GlobalSSPI.SSPIAuth, securityContext, input, sequenceNumber) : SSPIWrapper.DecryptMessage(GlobalSSPI.SSPIAuth, securityContext, input, sequenceNumber));
141 if (num != 0)
142 {
143 Exception ex = new Win32Exception(num);
144 if (System.Net.NetEventSource.Log.IsEnabled())
145 {
146 System.Net.NetEventSource.Error(null, ex, "Decrypt");
147 }
148 throw ex;
149 }
150 if (input[1].type != SecurityBufferType.SECBUFFER_DATA)
151 {
152 throw new InternalException(input[1].type);
153 }
154 newOffset = input[1].offset;
155 return input[1].size;
156 }
static readonly System.Net.NetEventSource Log
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static int DecryptNtlm(SafeDeleteContext securityContext, byte[] buffer, int offset, int count, bool isConfidential, out int newOffset, uint sequenceNumber)

References System.Net.Security.TwoSecurityBuffers._item0, System.buffer, System.count, System.Net.SSPIWrapper.DecryptMessage(), System.Net.Security.NegotiateStreamPal.DecryptNtlm(), 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.NTAuthentication.Decrypt().