How to make https request with self-signed cert?
Hi, I am trying to connect with DotNetTor to LND node REST API. LND node requires TLS connection with self-signed certificate.
Usually you can feed your httpHandler with provided certificate or disable ssl errors:
- https://stackoverflow.com/a/40168302/1194613
- https://stackoverflow.com/a/42722672/1194613
However in DotNetTor the Handler is not available.
Hi @kklara, I think this is related: https://github.com/nopara73/DotNetTor/issues/4
DotNetTor was originally written in .NET Core 1, which was lacking numerous things, I've tried to bring everything to new platforms, but due to lack of time I decided to maintain the parts those are relevant to me here:
- The library: https://github.com/zkSNACKs/WalletWasabi/tree/master/WalletWasabi/TorSocks5
- Examples: https://github.com/zkSNACKs/WalletWasabi/blob/master/WalletWasabi.Tests/TorTests.cs
Unfortunately I have to drop the HttpClient support somewhere along the line, but you can use TorHttpClient almost the same way:
using (var client = new TorHttpClient(new Uri("https://slack.com"), Global.TorSocks5Endpoint))
{
var content = await (await client.SendAsync(HttpMethod.Get, "api/api.test")).Content.ReadAsStringAsync();
Assert.Equal("{\"ok\":true}", content);
}
So the things is, if the published DotNetTor NuGet cannot do something, then you should try to use the code I'm using today in the above links. Do you experience your issue with the maintained library, too?