0

I am trying to decrypt AES 128 encrypted video with AES key and IV For decrypting I am using openssl

key —ØËÉްʾC{]5q)pZE4d4:-MBB¬vóRJ”7–Æ­‹5•Õ IV 0x496daa1c6914000e408c65cead91fc29

following is command line to decrypt video

openssl enc -nosalt -aes-128-cbc -d -in Question1.ts -base64 -K ^R-î^O¡ŒËÉްʾC^A{]5q)pZE4d4:-MBB^B¬vóR^TJ"7-Æ­‹5•Õ -iv 0x496daa1c6914000e408c65cead91fc29

I got this error

iv undefined

First I used AES key in command line in base64 format and got following error

hex string is too long, ignoring excess
non-hex digit
invalid hex iv value

then I used AES key in normal format and got error about IV

iv undefined

Which step should be followed to decrypt video with openssl?

  • Sometimes the IV is prepended to the cyphertext. Try using the first block (16 bytes) of the given cyphertext as an IV and the rest as the actual cyphertext. – rossum Nov 24 '22 at 11:34
  • 1
    -K and -iv are passed incorrectly. Both options require **hex encoded** data without leading 0x, s. [*openssl enc*](https://www.openssl.org/docs/man1.1.1/man1/enc.html) – Topaco Nov 24 '22 at 11:55
  • 1
    Regarding the key: For AES-128 the key is 16 bytes, so consists of 32 hex digits. Your key seems to be corrupted (possibly a wrong encoding). – Topaco Nov 24 '22 at 12:06
  • Yep, the reason that OpenSSL is using hexadecimals is precisely because keys and IV's usually consist of random bytes, and random bytes may not represent valid or *printable* characters. So you have to use the hexadecimal representation of the bytes instead (and, indeed, without the preceding `0x` :) ). Note that I seriously doubt that OpenSSL is the best tool for the job to decrypt *a stream of data*. – Maarten Bodewes Nov 24 '22 at 23:32

0 Answers0