I want to inquire that what are requirements of the audio input to be encrypted using AES. Is encrypting a mp3 file different from encrypting an aac file?


  • 2
    $\begingroup$ What problem are you trying to solve? $\endgroup$ – mikeazo Dec 4 '15 at 17:24
  • $\begingroup$ Modern ciphers encrypt bits and don't care about file format. $\endgroup$ – LightBit Dec 4 '15 at 18:01
  • $\begingroup$ @mikeazo I prepared for a presentation about audio encryption using AES. I claimed that the input can be any audio type. However, my professor argued that encrypting a mp3 file differed from encrypting a h264 file. That is why I asked this question. $\endgroup$ – Đạt Ngô Dec 5 '15 at 10:16

As LightBit notes in the comments, modern ciphers like AES work on arbitrary binary data, and don't care about what those bits represent. Thus, you can use AES to encrypt any kind of (audio or other) files or streams.

That said, there is one detail to keep in mind: basically all practical encryption schemes (including AES in any of the commonly used modes) leak the length of the data being encrypted. (Some schemes may round the length up to say, the next multiple of 16 bytes, but that still leaks the approximate length.)

When encrypting compressed data (like MP3 / AAC audio), this can in turn leak information about the content: for example, 1 second of silence compresses a lot better than 1 second of speech (which, in turn, compresses a lot better than 1 second of random noise). Thus, just by observing the length of the encrypted messages or packets, an attacker may be able to learn information about the sounds encoded in the encrypted data.

This is not just an academic concern: precisely this kind of an attack has been used to break VoIP audio encryption by researchers a few years ago. The CRIME and BREACH attacks on HTTPS also rely on compression leaking data about the plaintext via the message length, although those are not specific to audio.

The only general solution to message-length leaks is to ensure that all messages (or packets, for something like a real-time telephony protocol) have the same length (or, at least, that the message length only depends on things you're reasonably sure it's safe to leak, like the duration of the conversation). For audio encryption, this might be achieved e.g. by first using an audio compression algorithm with a fixed maximum bitrate, and then padding any compressed packets to a fixed length before encryption.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.