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

207
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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