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

149
Vistas
Use crypto.js with openssl

I'm trying to use crypto.js with openssl, so I would like to encrypt a message with one of them and decrypt with the other.

I included crypto.js from here: https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/crypto-js.min.js

I tried in js:

CryptoJS.AES.encrypt("This is a message", "secret").toString()

The result is:

"U2FsdGVkX1+BK06UxXoEdF5CkAhhxRPAN5r+XYLse/PSgtWI5e9BX3pkMBRpF6Te"

Then with openssl I do:

echo "U2FsdGVkX1+BK06UxXoEdF5CkAhhxRPAN5r+XYLse/PSgtWI5e9BX3pkMBRpF6Te" | openssl enc -d -a -aes-256-cbc -k "secret"

And I get this error:

*** WARNING : deprecated key derivation used.
Using -iter or -pbkdf2 would be better.
bad decrypt
140411423139136:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:../crypto/evp/evp_enc.c:610:
��+|�W��ۿ��4~

I also tried to add option -pbkdf2 to the openssl command, but I get a similar result.

And I also tried the other way like this:

echo "This is a message" | openssl enc -e -a -aes-256-cbc -k "secret" -pbkdf2

I get this result:

U2FsdGVkX1/QYJ+ZdUeun6mZn2aS+XxpnCTE3/50wc46Tvc3+JJxq+1rR3nS+4cP

Then in js I do:

CryptoJS.AES.decrypt("U2FsdGVkX1/QYJ+ZdUeun6mZn2aS+XxpnCTE3/50wc46Tvc3+JJxq+1rR3nS+4cP", "secret").toString(CryptoJS.enc.Utf8)

And I get:

""

I also tried to remove option -pbkdf2 in openssl command but I get the same result.

I spent hours on this problem, trying to change the algorithm, size key, etc. without finding any solution. Stack overflow is my last hope.

Thanks in advance.

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