Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 4.05 KB

aes_cbc_256_string_decryption_only.md

File metadata and controls

57 lines (40 loc) · 4.05 KB

Cross-platform cryptography

AES CBC mode 256 string decryption only

If you received a message that was encrypted by one of my AES CBC 256 string encryption-programs here is the decryption only solution for one of the other platforms.

steps in the program

The program follows the usual sequence but starting with decryption:

  1. enter the random encryption key in Base64 encoding
  2. enter the complete ciphertext (iv:ciphertext) in Base64 encoding
  3. start the decryption process
  4. split the complete ciphertext-string into iv and ciphertext
  5. Base64 decoding of the encryption key and the ciphertext
  6. set the decryption parameters (same as used for encryption)
  7. decrypt the ciphertext and show the resulting plaintext

If you like to see the encryption part see my separate article AES CBC mode 256 string encryption.

Serious notice: although the program looks like simple there is NO CHANCE for recovering the original plaintext without the key used for encryption!

⚠️ Security warning ⚠️

This is a serious warning regarding the security of the programs shown in these article series. Always keep in mind my disclaimer regarding my programs: All programs are for educational purposes and are not intended to use in production or any other programs where a secure solution is needed. The programs do not have proper exceptional/error handling and in some cases they use insecure key lengths or other methods that are insecure. Never ever use the programs in real life unless checked by a qualified professional cryptographer.

The following links provide the solutions in code and an online compiler that runs the code.

Language available Online-compiler
Java repl.it CpcJavaAesCbc256StringDecryptionOnly
PHP repl.it CpcPhpAesCbc256StringDecryptionOnly
C# repl.it CpcCsharpAesCbc256StringDecryptionOnly
Javascript CryptoJs repl.it AesCbc256StringDecryptionOnly
NodeJS Crypto repl.it CpcNodeJsCryptoAesCbc256StringDecryptionOnly
NodeJS node-forge repl.it CpcNodeJsAesCbc256StringDecryptionOnly
Python *1) see the full version
Dart *2) no online compiler available

*1) you need the external library pycryptodome, version 3.9.9

*2) you need the external library pointycastle version 3.1.1

This is an output (as there are random elements your output will differ):

AES CBC 256 String Decryption only

* * * Decryption * * *
decryptionKey (Base64): d3+KZq3lsdy5Hgd1VRVQFUhA9jU0PaBHTG2LG2PazQM=
ciphertext (Base64): 8GhkycnbzDo5WbRol5zfCQ==:gQrTOJdobbI4fuCHCfu5eqKFYCaw/AM6xMK2o+xCXB0MeAQ7rFbXAbAE3Ex+bD8c
input is (Base64) iv : (Base64) ciphertext
plaintext:  The quick brown fox jumps over the lazy dog

Last update: Aug. 18th 2021

Back to the main page: readme.md