Skip to content

Commit

Permalink
Use TlsAlertMessage enum to make exception messages more readable (#7…
Browse files Browse the repository at this point in the history
  • Loading branch information
rzikm committed Jul 19, 2022
1 parent 9ad3026 commit c0ddf0f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/libraries/System.Net.Quic/src/System.Net.Quic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
<Compile Include="$(CommonPath)System\Net\SocketAddress.cs" Link="Common\System\Net\SocketAddress.cs" />
<Compile Include="$(CommonPath)System\Net\IPAddressParserStatics.cs" Link="Common\System\Net\IPAddressParserStatics.cs" />
<Compile Include="$(CommonPath)System\Net\Internals\IPEndPointExtensions.cs" Link="Common\System\Net\Internals\IPEndPointExtensions.cs" />
<Compile Include="$(CommonPath)System\Net\Security\TlsAlertMessage.cs"
Link="Common\System\Net\Security\TlsAlertMessage.cs" />
</ItemGroup>
<!-- Unsupported platforms -->
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == ''">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using Microsoft.Quic;
using System.Security.Authentication;
using System.Net.Security;
using static Microsoft.Quic.MsQuic;

namespace System.Net.Quic;
Expand Down Expand Up @@ -89,7 +90,7 @@ static Exception GetExceptionInternal(int status, string? message)
//
if ((uint)status >= (uint)QUIC_STATUS_CLOSE_NOTIFY && (uint)status < (uint)QUIC_STATUS_CLOSE_NOTIFY + 256)
{
int alert = status - QUIC_STATUS_CLOSE_NOTIFY;
TlsAlertMessage alert = (TlsAlertMessage)(status - QUIC_STATUS_CLOSE_NOTIFY);
return new AuthenticationException(SR.Format(SR.net_auth_tls_alert, alert));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
<Compile Include="System\Net\Security\SslConnectionInfo.cs" />
<Compile Include="System\Net\Security\StreamSizes.cs" />
<Compile Include="System\Net\Security\TlsAlertType.cs" />
<Compile Include="System\Net\Security\TlsAlertMessage.cs" />
<Compile Include="System\Net\Security\TlsFrameHelper.cs" />
<!-- NegotiateStream -->
<Compile Include="System\Net\NTAuthentication.cs" />
Expand Down Expand Up @@ -84,6 +83,8 @@
Link="Common\System\NotImplemented.cs" />
<Compile Include="$(CommonPath)System\Threading\Tasks\TaskToApm.cs"
Link="Common\System\Threading\Tasks\TaskToApm.cs" />
<Compile Include="$(CommonPath)System\Net\Security\TlsAlertMessage.cs"
Link="Common\System\Net\Security\TlsAlertMessage.cs" />
<Compile Include="$(CommonPath)System\Net\Security\SafeCredentialReference.cs"
Link="Common\System\Net\Security\SafeCredentialReference.cs" />
<Compile Include="$(CommonPath)System\Net\Security\SSPIHandleCache.cs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
Link="Common\System\Net\Security\MD4.cs" />
<Compile Include="$(CommonPath)System\Net\Security\RC4.cs"
Link="Common\System\Net\Security\RC4.cs" />
<Compile Include="$(CommonPath)System\Net\Security\TlsAlertMessage.cs"
Link="Common\System\Net\Security\TlsAlertMessage.cs" />
<Compile Include="..\..\src\System\Net\Security\NetEventSource.Security.cs"
Link="ProductionCode\System\Net\Security\NetEventSource.Security.cs" />
<Compile Include="..\..\src\System\Net\Security\SslStream.cs"
Expand All @@ -76,8 +78,6 @@
Link="ProductionCode\Common\System\Net\SecurityProtocol.cs" />
<Compile Include="..\..\src\System\Net\Security\TlsAlertType.cs"
Link="ProductionCode\Common\System\Net\TlsAlertType.cs" />
<Compile Include="..\..\src\System\Net\Security\TlsAlertMessage.cs"
Link="ProductionCode\Common\System\Net\TlsAlertMessage.cs" />
<Compile Include="..\..\src\System\Net\Security\TlsFrameHelper.cs"
Link="ProductionCode\Common\System\Net\TlsFrameHelper.cs" />
<Compile Include="$(CommonPath)Interop\Windows\SChannel\Interop.Alerts.cs"
Expand Down

0 comments on commit c0ddf0f

Please sign in to comment.