Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,24 @@ internal static SslPolicyErrors VerifyCertificateProperties(

X509Certificate2? result = null;

SafeX509ChainHandle chainHandle = securityContext switch
SafeX509ChainHandle? chainHandle = securityContext switch
{
SafeDeleteNwContext nwContext => nwContext.PeerX509ChainHandle!,
SafeDeleteNwContext nwContext => nwContext.PeerX509ChainHandle,
SafeDeleteSslContext sslContext => Interop.AppleCrypto.SslCopyCertChain(sslContext.SslContext),
_ => throw new ArgumentException("Invalid context type", nameof(securityContext))
};

if (chainHandle is null || chainHandle.IsInvalid)
{
if (securityContext is SafeDeleteSslContext)
Comment thread
liveans marked this conversation as resolved.
{
chainHandle?.Dispose();
}

if (NetEventSource.Log.IsEnabled()) NetEventSource.Log.RemoteCertificate(result);
return result;
}

try
{
long chainSize = Interop.AppleCrypto.X509ChainGetChainSize(chainHandle);
Expand Down
Loading