Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
Inquiry About AES Encrypting Practice

I'm using NodeJS's crypto library and Crypto-JS. From the crypto library, I am generating ECDH client and generating the keys from which to use its private key for AES encryption with Crypto-JS in the future. the AES encryption function requires you to pass in a private key, which was done but it would not take it as a Buffer. It works when I use the hex string version, but I'm naïve and unsure if this has the strength of the ECDH private key I encoded to hex string.

Snippets of code to analyze (assume inData variable is a string):

var privBIN = programData.volatile.modularVariables.key; //some ECDH secret hex encoded
var inData = 'something';
var cipherInData = programData.volatile.modularVariables.cipherText(inData,privBIN);

key and value in programData object:

cipherText: (content, key)=>{console.log(`content: ${content}`); console.log(`key: ${key}`); return cryptojs.AES.encrypt(content,key).toString()},

The above ciphers the text in AES fine, but substitute priveBIN for:

var privBIN = Buffer.from(programData.volatile.modularVariables.key,programData.volatile.modularVariables.encoding.hex);

and suddenly it gives me the following error (I included where in crypto-js it has issues):

(node:15028) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined
    at Object.xorBlock (C:\Users\Mickell\Desktop\CPHR\node_modules\crypto-js\cipher-core.js:371:44)
    at Object.processBlock (C:\Users\Mickell\Desktop\CPHR\node_modules\crypto-js\cipher-core.js:314:27)
    at Object._doProcessBlock (C:\Users\Mickell\Desktop\CPHR\node_modules\crypto-js\cipher-core.js:486:25)
    at Object._process (C:\Users\Mickell\Desktop\CPHR\node_modules\crypto-js\core.js:632:27)
    at Object._doFinalize (C:\Users\Mickell\Desktop\CPHR\node_modules\crypto-js\cipher-core.js:501:46)
    at Object.finalize (C:\Users\Mickell\Desktop\CPHR\node_modules\crypto-js\cipher-core.js:163:44)
    at Object.encrypt (C:\Users\Mickell\Desktop\CPHR\node_modules\crypto-js\cipher-core.js:685:41)
    at Object.encrypt (C:\Users\Mickell\Desktop\CPHR\node_modules\crypto-js\cipher-core.js:201:59)

Questions: can someone explain if the hex encoded version of the ECDH client's private key suffices? Or is that completely negligible and its the private key as buffer I should pass in and how? Thank you for your time :).

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda