I am trying to decrypt aes-256-ecb encoded password using OpenSSL with the following (captured during a ctf only) informations:
##PASS_16##
oRnS7llE9q3utIvyP1rbK4OPVDjOPdEss36jsgu/Yvfh9yx0qR530oV8eLH9fxw2
AES-ECB-256
Key : thisIsTheSharedKeyIShouldKeepOK!
From what I gathered I understood that :
- ecb mode doesn't have an IV to be specified
- the ciphertext is base64 encoded so need to decide it before decryption
- as my key is long enough, it doesn't need padding
decoded_cipher.txt contains the result of the following command :
echo "oRnS7llE9q3utIvyP1rbK4OPVDjOPdEss36jsgu/Yvfh9yx0qR530oV8eLH9fxw2" | base64 -d > decoded_cipher.txt
key.txt :
thisIsTheSharedKeyIShouldKeepOK!
hex_key.txt
7468697349735468655368617265644b65794953686f756c644b6565704f4b21
this openssl command :
openssl enc -aes-256-ecb -d -in decoded_cipher.txt -out decrypted.txt -K 7468697349735468655368617265644b65794953686f756c644b6565704f4b21 -nopad
gives me this error :
bad decrypt 40678142ED7F0000:error:1C80006B:Provider routines:ossl_cipher_generic_block_final:wrong final block length:../providers/implementations/ciphers/ciphercommon.c:429:
The final result should follow the following pattern : PASS_16{alphanumerical_message}) or alphanumerical_message
Does someone have an idea on how to decipher this encrypted message properly ?