61 {
62 SecPkgContext_Sizes attribute = default(SecPkgContext_Sizes);
63 bool flag = SSPIWrapper.QueryBlittableContextAttributes(GlobalSSPI.SSPIAuth, securityContext, global::Interop.SspiCli.ContextAttribute.SECPKG_ATTR_SIZES, ref attribute);
64 int num = checked(2147483643 - attribute.cbBlockSize - attribute.cbSecurityTrailer);
66 {
68 }
69 int num2 = buffer.Length + attribute.cbSecurityTrailer + attribute.cbBlockSize;
70 if (output == null || output.Length < num2 + 4)
71 {
72 output = new byte[num2 + 4];
73 }
74 buffer.CopyTo(output.AsSpan(4 + attribute.cbSecurityTrailer));
75 ThreeSecurityBuffers threeSecurityBuffers = default(ThreeSecurityBuffers);
76 Span<SecurityBuffer>
input =
MemoryMarshal.CreateSpan(ref threeSecurityBuffers._item0, 3);
77 input[0] =
new SecurityBuffer(output, 4, attribute.cbSecurityTrailer, SecurityBufferType.SECBUFFER_TOKEN);
78 input[1] =
new SecurityBuffer(output, 4 + attribute.cbSecurityTrailer,
buffer.Length, SecurityBufferType.SECBUFFER_DATA);
79 input[2] =
new SecurityBuffer(output, 4 + attribute.cbSecurityTrailer +
buffer.Length, attribute.cbBlockSize, SecurityBufferType.SECBUFFER_PADDING);
80 int num3;
81 if (isConfidential)
82 {
83 num3 = SSPIWrapper.EncryptMessage(GlobalSSPI.SSPIAuth, securityContext,
input, sequenceNumber);
84 }
85 else
86 {
87 if (isNtlm)
88 {
89 input[1].type |= SecurityBufferType.SECBUFFER_READONLY;
90 }
91 num3 = SSPIWrapper.MakeSignature(GlobalSSPI.SSPIAuth, securityContext,
input, 0u);
92 }
93 if (num3 != 0)
94 {
97 {
99 }
100 throw ex;
101 }
102 num2 =
input[0].size;
103 bool flag2 = false;
104 if (num2 != attribute.cbSecurityTrailer)
105 {
106 flag2 = true;
108 }
109 num2 +=
input[1].size;
110 if (
input[2].size != 0 && (flag2 || num2 !=
buffer.Length + attribute.cbSecurityTrailer))
111 {
113 }
114 num2 +=
input[2].size;
115 output[0] = (byte)((uint)num2 & 0xFFu);
116 output[1] = (byte)((uint)(num2 >> 8) & 0xFFu);
117 output[2] = (byte)((uint)(num2 >> 16) & 0xFFu);
118 output[3] = (byte)((uint)(num2 >> 24) & 0xFFu);
119 return num2 + 4;
120 }
static readonly System.Net.NetEventSource Log
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static string Format(string resourceFormat, object p1)
static string net_io_out_range