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

206
Vistas
How can I identify a double AES encrypted cipherText

I mistakenly encrypted some of my values in the db twice. Is there a way to identify double encrypted ciphertext.

    var ciphertext = cryptoJS.AES.encrypt(plainText, secretKey).toString();
    var ciphertext2 = cryptoJS.AES.encrypt(ciphertext, secretKey).toString();
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There are two ways to do this, and both are high certainty but have drawbacks.

First of all, if you don't give an well formatted key / IV then CryptoJS will use an OpenSSL key derivation mechanism to derive the key and IV. If you use toString() it will then stringify the result. This of course adds some overhead, so if you know the original size of the message then you can simply try and detect double encryption by the increase of the size.

Second, you can decrypt once, and then look for the format that toString generates. This is a base 64 string which, after decoding, should contain Salted__ in ASCII (followed by the salt and then the AES-CBC / PKCS#7 ciphertext). As your plaintext is unlikely to start with Salted__ this should be enough of a distinguisher. So your decrypt routine could run in a loop until the Salted__ string isn't found anymore.

Otherwise: AES encrypted ciphertext is fully randomized, so you cannot see anything looking at the ciphertext itself. In this case however, the ciphertext is part of a proprietary protocol, which opens up some possiblities.

about 4 years ago · Juan Pablo Isaza Denunciar
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