PlayReady license server for content encoded and encrypted by Envivio 4Caster C4

The Envivio 4Caster™ C4 · Gen III is an encoding/transcoding solution for producing live video streams for Mobile TV, Internet TV and IPTV. It provides integrated content encoding and PlayReady encryption. When Envivio 4Caster C4 is used to encode and encrypt live video stream, a PlayReady license server is required for clients to acquire PlayReady license.

According to Envivio PlayReady Key Provisioning Interface document, a key server response to 4Caster C4 key request will look like below:

<S:Envelope xmlns:S="">


    <GetProtectionInfoResponse xmlns="urn:ContentProtection:1.0">


        <Parameter Name="Key">5e051a025e8823aae663d8d34f584820</Parameter>

        <Parameter Name="KeyId">XgUaAl6II6rmY9jTT1hIEB==</Parameter>

        <Parameter Name="LicenseAcquisitionUrl">http://server/playready/rightsmanager.asmx</Parameter>

        <Parameter Name="LicenseAcquisitionUiUrl">http://server/playready/rightsmanager.asmx</Parameter>

        <Parameter Name="ServiceId">XgUaAl6II6rmY9jTT1hIEA==</Parameter>

        <Parameter Name="CustomAttributes">&lt;![CDATA[&lt;CUSTOMATTRIBUTES xmlns="">&lt;meta:title>Gone with the Wind&lt;/meta:title>&lt;/CUSTOMATTRIBUTES>]]</Parameter>






According to Envivio PlayReady Key Provisioning Interface document,

  • Key (required). This is the content key. The expected value for this attribute is a 16-byte AES key in hexadecimal format (e.g. “7AB15019FE1F4109”).
  • KeyId (required). This is a string that uniquely identifies the key within the system. The expected value for this attribute is a 16-byte key identifier in base-64 encoding (e.g. “Ja716gdj1USDr1/X44o2AQ==”).

AESContentKey in Microsoft.Media.Drm namespace has two constructors:

  1. AESContentKey(byte[] key, Guid keyId);
  2. AESContentKey(Guid keyId, byte[] keySeed);

Since Envivio does not use key seed, we have to use encryption key and the first constructor to create an AESContentKey object to pass to the MediaLicense  object.

On PlayReady license server, we need to do the following:

  1. Retrieve encryption key from a key management server;
  2. Convert 16-byte AES key in hexadecimal format to a byte array;
  3. Use the first AESContentKey constructor to create an AESContentKey object.

            string key = "5e051a025e8823aae663d8d34f584820";   //hex

            MediaLicense leafLicense = new MediaLicense();

            leafLicense.ContentEncryptionKey = new AESContentKey(StringToByteArray(key), new Guid("021a055e-885e-aa23-e663-d8d34f584820"));


where StringToByteArray method shown below converts a 16-byte string in hexadecimal format into byte array.

        public static byte[] StringToByteArray(string hex)


            int NumberChars = hex.Length;

            byte[] bytes = new byte[NumberChars / 2];

            for (int i = 0; i < NumberChars; i += 2)

                bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);

            return bytes;



The complete flow is:

  1. 4Caster C4 retrieves encryption key from key management server;
  2. 4Caster C4 encodes and encrypts live video stream into PlayReady protected Smooth Streams;
  3. Silverlight player downloads Smooth Streams;
  4. Silverlight player acquires license from PlayReady license server and decrypt the content.
Comments (0)

Skip to main content