Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TorSharpToolFetcher issue: The requested security protocol is not supported #104

Open
AlizerUncaged opened this issue Aug 30, 2023 · 3 comments

Comments

@AlizerUncaged
Copy link

AlizerUncaged commented Aug 30, 2023

I get the following error

System.NotSupportedException: The requested security protocol is not supported.
   at System.Net.ServicePointManager.ValidateSecurityProtocol(SecurityProtocolType value)
   at System.Net.ServicePointManager.set_SecurityProtocol(SecurityProtocolType value)
   at Knapcode.TorSharp.TorSharpToolFetcher.EnableSecurityProtocols() in /_/src/TorSharp/TorSharpToolFetcher.cs:line 229

here's my code, copied right from the ReadMe

    public async Task SetupTor()
    {
        _logger.LogInformation($"Downloading tor...");
        using (var httpClient = new HttpClient())
        {
            var fetcher = new TorSharpToolFetcher(_settings, httpClient);
            await fetcher.FetchAsync();
        }
    }

screenshot
image

I use .NET 7, my host OS is Windows 11 x64

@AlizerUncaged AlizerUncaged changed the title TorSharpToolFetcher issue TorSharpToolFetcher issue: The requested security protocol is not supported Aug 30, 2023
@AlizerUncaged
Copy link
Author

AlizerUncaged commented Aug 30, 2023

I was able to fix this by settings EnableSecurityProtocolsForFetcher to false in my _settings_ following #28, however it seems 1.8.4 should resolve this issue but seems like the fallback doesn't work...?

@i-lamrani
Copy link
Contributor

Hello your can resolve your issue by adding this parameters to the settings EnableSecurityProtocolsForFetcher = false;
and and use HttpClient with a handler that ignore ssl validations like this :
var handler = new HttpClientHandler();
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
handler.ServerCertificateCustomValidationCallback =
(httpRequestMessage, cert, cetChain, policyErrors) =>
{
return true;
};
// download tools
await new TorSharpToolFetcher(_settings, new HttpClient(handler)).FetchAsync();

@joelverhagen
Copy link
Owner

What platform is this occurring on? I would like to know:
OS version (Linux distribution and version if applicable)
.NET version (with dotnet --info)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants