Mirrory
Mirrory
CC#
Created by Mirrory on 5/31/2023 in #help
❔ tls 1.2 server
I'm the server and for some weird reason other than the server certificate I also have to send right after that the ca-chain. How do i do it in .net framework 4.7.2?
static void ProcessClient (TcpClient client)
{
// A client has connected. Create the
// SslStream using the client's network stream.
SslStream sslStream = new SslStream(
client.GetStream(), false);
// Authenticate the server but don't require the client to authenticate.
try
{
sslStream.AuthenticateAsServer(serverCertificate, clientCertificateRequired: false, checkCertificateRevocation: true);
...
static void ProcessClient (TcpClient client)
{
// A client has connected. Create the
// SslStream using the client's network stream.
SslStream sslStream = new SslStream(
client.GetStream(), false);
// Authenticate the server but don't require the client to authenticate.
try
{
sslStream.AuthenticateAsServer(serverCertificate, clientCertificateRequired: false, checkCertificateRevocation: true);
...
2 replies
CC#
Created by Mirrory on 5/11/2023 in #help
❔ tls 1.2 serverclient
I'm struggling a lot for something that maybe is very simple. I have to upgrade a simulator with tls functionality. This simulator is some sort of gateway: starts as a server then sometimes it is tasked to send stuff to various clients With socket I have no issue. I read everything and when it's time to send I send in chunks using .Send() For tls I'm using sslstream. Instead of a socket I initialize a tcpListener, listen for it and get the client. From its stream I get the sslstream and then I authenticate as server and I start reading everything with no issue. When it's time to send I also send in chunks using first write then flush. The client unfortunately just dies and reinits himself. I tried almost everything even with protocol dumps at one point I get an RST and it's over. I also don't think after initializing and finishing the handshake I can go back using socket. tcpClient.Client is the underlying socket (?) but I don't think I can freely use it If anyone has an advice most welcome
2 replies
CC#
Created by Mirrory on 11/20/2022 in #help
❔ run unknown amount of tasks for some time
I'm using a function async Task<stuff> which returns me an user interaction. Since many users could interact at the same time, how do I run multiple task in parallel without knowing how many for X amount of time? Doing
While(someTimerHandler){
myList.add(await GetUserInteraction())
}
While(someTimerHandler){
myList.add(await GetUserInteraction())
}
Would lose me data
4 replies
CC#
Created by Mirrory on 11/19/2022 in #help
❔ Awaiting for multiple interactions DSharp+
I'm using DSharp+ Library Right now i'm doing this:
var result = await interactivity.WaitForButtonAsync(pollMessage).ConfigureAwait(false);
var result = await interactivity.WaitForButtonAsync(pollMessage).ConfigureAwait(false);
but obviously I get the first message and then the code goes through. The expected outcome I want is like set a timer (I can do that) and until then collect all the results (multiple discord users clicking on the buttons) and then at the end of the timer, elaborate the data (I can do that). I really have no clue on how to do that, I probably need to use tasks or thread but I've never used them. If you can help me and also point me towards some good resources on that I would love it
67 replies