Monday, November 24, 2008

Applying forward-locking to videos for mobile devices

Forward locking is a form of Digital Rights Management (DRM) which can be applied to mobile content. There are 3 forms of DRM which can be applied to mobile content i.e.
  • Forward Locking (Basic form whereby the content cannot be forwarded via bluetooth/mms to another handset).
  • Combined Delivery (Can be used to apply further constraints to the content e.g. number of times the content can be accessed or the number of days the content is available for).
  • Separate Delivery (Most secure form of DRM, whereby the content is unlocked by a key sent to the handset via SMS).
Below is an example (in java) of how to apply basic forward locking to a video item:

//get video file - getVideoFile() returns the actual binary file as a byte array
byte[] videoData = getVideoFile();

//get content length including the length of the additional DRM headers
//i.e. "--foo\r\nContent-Type ...."
int contentlength = getContentLength();

//binary forward locked content is sent to the handset
ServletOutputStream sos = response.getOutputStream();

//sending the content length
response.setIntHeader("Content-length", contentlength);

//sending the drm header
response.setHeader("Content-Type","application/vnd.oma.drm.message; boundary=foo");
sos.println("--foo");
sos.println("Content-Type: video/3gpp");
sos.println("Content-Transfer-Encoding: binary");
sos.println("");
//sending the actual video file
sos.write(videoData);
sos.println();
sos.println("--foo--");
sos.flush();


The methods getVideoFile() and getContentLength() need to be written before this code can be executed. The code segment above is from the doGet(HttpServletRequest request, HttpServletResponse response) method in a java servlet.