Flussonic Media Server documentation

Trivial key server

Here goes an example of most primitive key server for AES-128 or SAMPLE-AES:
<?php


if($_SERVER["SCRIPT_NAME"] == "/cas-server") {
  header("HTTP/1.0 200 OK");
  $resource = $_GET["file"];
  $number = $_GET["number"];
  error_log("Server is requesting key ".$number." for ".$resource." from ".$_SERVER["REMOTE_ADDR"]);
  header("X-Key-Url: http://".$_SERVER["HTTP_HOST"]."/user-key?name=".$resource."&number=".$number);

  $input = $resource.".".$number;
  $key = hash('md4',$input);
  header("Content-Length: ".strlen($key));
  echo $key;
  die();
}

if($_SERVER["SCRIPT_NAME"] == "/user-key") {
  header("HTTP/1.0 200 OK");
  $resource = $_GET["name"];
  $number = $_GET["number"];

  $input = $resource.".".$number;
  $key = hex2bin(hash('md4',$input));
  header("Content-Length: ".strlen($key));
  header("Content-Type: application/octet-stream");
  error_log("User is requesting key ".$number." for ".$resource." from ".$_SERVER["REMOTE_ADDR"]);
  echo $key;
  die();
}

error_log(print_r($_SERVER,true));

?>

Configure DRM for stream in the following way:

stream ort {
  url udp://239.0.0.1:1234;
  hds off;
  rtmp off;
  rtsp off;
  dash off;
  mpegts off;
  drm aes128 keyserver=http://192.168.0.80:4500/;
}

where http://192.168.0.80:4500/ is an url of PHP script above

Flussonic will rotate keys once per 10 minutes.