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

◆ RenegotiateAsync< TIOAdapter >()

async Task System.Net.Security.SslStream.RenegotiateAsync< TIOAdapter > ( TIOAdapter adapter)
inlineprivate
Type Constraints
TIOAdapter :IReadWriteAdapter 

Definition at line 1051 of file SslStream.cs.

1051 : IReadWriteAdapter
1052 {
1053 if (Interlocked.Exchange(ref _nestedAuth, 1) == 1)
1054 {
1055 throw new InvalidOperationException(System.SR.Format(System.SR.net_io_invalidnestedcall, "NegotiateClientCertificateAsync", "renegotiate"));
1056 }
1057 if (Interlocked.Exchange(ref _nestedRead, 1) == 1)
1058 {
1059 throw new NotSupportedException(System.SR.Format(System.SR.net_io_invalidnestedcall, "ReadAsync", "read"));
1060 }
1061 if (Interlocked.Exchange(ref _nestedWrite, 1) == 1)
1062 {
1063 _nestedRead = 0;
1064 throw new NotSupportedException(System.SR.Format(System.SR.net_io_invalidnestedcall, "WriteAsync", "write"));
1065 }
1066 try
1067 {
1068 if (_decryptedBytesCount != 0)
1069 {
1071 }
1072 _sslAuthenticationOptions.RemoteCertRequired = true;
1073 _isRenego = true;
1074 byte[] output;
1075 SecurityStatusPal status = _context.Renegotiate(out output);
1076 if (output != null && output.Length != 0)
1077 {
1078 await adapter.WriteAsync(output, 0, output.Length).ConfigureAwait(continueOnCapturedContext: false);
1079 await adapter.FlushAsync().ConfigureAwait(continueOnCapturedContext: false);
1080 }
1081 if (status.ErrorCode != SecurityStatusPalErrorCode.OK)
1082 {
1083 if (status.ErrorCode != SecurityStatusPalErrorCode.NoRenegotiation)
1084 {
1085 throw SslStreamPal.GetException(status);
1086 }
1087 return;
1088 }
1089 _handshakeBuffer = new ArrayBuffer(4160);
1090 ProtocolToken message;
1091 do
1092 {
1093 message = await ReceiveBlobAsync(adapter).ConfigureAwait(continueOnCapturedContext: false);
1094 if (message.Size > 0)
1095 {
1096 await adapter.WriteAsync(message.Payload, 0, message.Size).ConfigureAwait(continueOnCapturedContext: false);
1097 await adapter.FlushAsync().ConfigureAwait(continueOnCapturedContext: false);
1098 }
1099 }
1100 while (message.Status.ErrorCode == SecurityStatusPalErrorCode.ContinueNeeded);
1102 {
1106 }
1108 }
1109 finally
1110 {
1111 _nestedRead = 0;
1112 _nestedWrite = 0;
1113 _isRenego = false;
1114 }
1115 }
SecurityStatusPal Renegotiate(out byte[] output)
SslAuthenticationOptions _sslAuthenticationOptions
Definition SslStream.cs:62
bool CompleteHandshake(ref ProtocolToken alertToken, out SslPolicyErrors sslPolicyErrors, out X509ChainStatusFlags chainStatus)
static string net_ssl_renegotiate_buffer
Definition SR.cs:124
static string net_io_invalidnestedcall
Definition SR.cs:24
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7
static int Exchange(ref int location1, int value)
Span< byte > ActiveSpan
void CopyTo(Span< T > destination)
Definition Span.cs:224

References System.Net.Security.SslStream._context, System.Net.Security.SslStream._decryptedBytesCount, System.Net.Security.SslStream._handshakeBuffer, System.Net.Security.SslStream._internalBuffer, System.Net.Security.SslStream._internalBufferCount, System.Net.Security.SslStream._isRenego, System.Net.Security.SslStream._nestedAuth, System.Net.Security.SslStream._nestedRead, System.Net.Security.SslStream._nestedWrite, System.Net.Security.SslStream._sslAuthenticationOptions, System.Net.ArrayBuffer.ActiveLength, System.Net.ArrayBuffer.ActiveSpan, System.Net.Security.SslStream.CompleteHandshake(), System.Span< T >.CopyTo(), System.Net.SecurityStatusPal.ErrorCode, System.Threading.Interlocked.Exchange(), System.SR.Format(), System.Net.Security.SslStreamPal.GetException(), System.SR.net_io_invalidnestedcall, System.SR.net_ssl_renegotiate_buffer, System.Net.Security.ProtocolToken.Payload, System.Net.Security.SecureChannel.Renegotiate(), System.Net.Security.SslStream.ResetReadBuffer(), System.Net.Security.ProtocolToken.Size, and System.Net.Security.ProtocolToken.Status.