Search code examples
phpencryptionaeswowzahttp-live-streaming

AES-128 (WOWZA) in PHP. How to do this?


I'm using Wowza Streaming Engine and I want to encrypt mp4 files in HLS streaming method but I don't know how to create AES-128 keys in PHP?

Wowza has its own genkey but it's in java and have to be done in SSH. I want to do this in PHP but I don't know how it creates key? Informations about generating keys are here - https://www.wowza.com/docs/how-to-secure-apple-http-live-streaming-aes-128-external-method

Can you tell me how to generate keys like this in PHP?


Solution

  • The key can be anything you want as long as it's 16-bytes (128 bits) and formatted as a hexadecimal string:

    $key = strtoupper(bin2hex(random_bytes(16)));