Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

173
Visualizações
NodeJS 14+ use RC4-MD5 cipher algorithm with tls native package

I'm working on a project and i need to open tls socket between NodeJS server and a device (http server embedded on electronic card, which operates on a PIC).

This device only support RC4-MD5 encryption algorithm but it's deprecated since Node 9 (I currently working on Node 14.17.5)

How can i implement RC4-MDR5 algorithm in NodeJS without downgrade my node version ?

My code actually:

const tls = require('tls');

let tlsOpts = { // TLS options
  key: fs.readFileSync(path.resolve('dist/assets/cert/privkey.pem')),
  cert: fs.readFileSync(path.resolve('dist/assets/cert/cert.pem')),
  rejectUnauthorized: false,
  ciphers: 'RC4-MD5' // This line throw error: SSL routines:SSL_CTX_set_cipher_list:no cipher match
};

this.server = tls.createServer(tlsOpts, async (socket) => { // Create server
  socket.setEncoding('utf8');
  this.events(socket); // Create event listeners (data, error, close, etc...)
}).listen(this.config.get('TCP_PORT'), () => {
  this.logger.log('TCP server started (port '+this.config.get('TCP_PORT')+')'); // Log server start
});

Edit: To go further, how can i implement my own encryption algorithm and use it with the node tls package ?

Ex:

let tlsOpts = { // TLS options
  key: fs.readFileSync(path.resolve('dist/assets/cert/privkey.pem')),
  cert: fs.readFileSync(path.resolve('dist/assets/cert/cert.pem')),
  rejectUnauthorized: false,
  ciphers: 'My-Custom-Cipher' // Here use my custom algorithm
}

Note: I'm using NestJS framework, that why i have the syntax "this.[...]" in my code.

Thanks.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda