#TLSSocket

1 messages · Page 1 of 1 (latest)

granite gate
#

Create a tls server using a server.key and server.crt allowing unauthorized and trusting certs.

abstract coralBOT
#

<@&987246452180930620> please have a look, thanks.

abstract coralBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

#

You can use </chatgpt:1108714622413963314> to ask ChatGPT about your question while you wait for a human to respond.

granite gate
#
const tlsServerOptions = {
  key: fs.readFileSync('./certs/server.key'),
  cert: fs.readFileSync('./certs/server.crt'),
  rejectUnauthorized: false,
  requestCert: false
};

tls.createServer(tlsServerOptions, (socket) => {
  socket.targetTlsBuffer = Buffer.alloc(0);

  socket.targetTls = tls.connect(tlsClientOptions, () => {
    if (socket.targetTlsBuffer.length > 0) {
      socket.targetTls.write(socket.targetTlsBuffer);
    }
  });
socket.targetTls.on('data', buffer => {
    console.log(buffer.toString());
  });

  socket.on('data', buffer => {
    console.log(buffer.toString());
  });
}).listen(port);

Something similar to this but in java.

#

I couldn't find a way to get it working with key and crt in java.

#

I proceeded to use PKCS12, but server connects were not successful still

abstract coralBOT
#

@granite gate

Java and JavaScript are two completely unrelated programming languages.
https://i.imgur.com/yYFdXet.png

wise rain
#

Perhaps you'd find better support if you used the other tag for your thread instead of Java

#

or web etc

sour geode
#

if you want to use java, consider looking at vert.x

granite gate
#

That's why I said something similar to this in java

#

So can it be used to create tls servers?

brazen solar
granite gate
#

If yes, then it's no problem for me to switch.

sour geode
#

yeah but also look at somerandom's link - that's pretty good if you don't want any deps