Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 2
Registered: ‎10-25-2011
My Device: Blackberry Torch
My Carrier: AT&T

HELP: DRMException "Unable to parse DRM v2 header"

I'm building an application (JDE 7.0 platform) that makes use of DRMManager APIs. However when the application invokes the "getLicenseChallenge()" API, a DRMException is generated with the detail message"Unable to parse DRM v2 header". 

 

 If anyone know how to solve this problem, please help me. Also does the media file need to be encoded with a DRM header?

Thanks

 

--Tom

 

        String fURI = "file:///" + fileholder.getPath() + fileholder.getFileName();
        DRMManager manager = DRMManager.getManager();
        String[] perm = new String[]{DRMManager.PERMISSION_DISPLAY};

        byte[] permission;
        
        try {
            permission = manager.getLicenseChallenge(fURI, perm);
        }
        catch( ControlledAccessException c)
        {
            c.printStackTrace();
        }
        catch (DRMException e )
        {
            e.printStackTrace();
        }

BlackBerry Development Advisor
Posts: 15,753
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: HELP: DRMException "Unable to parse DRM v2 header"

What type of DRM are you using?  What format is the media file?  Can you post a link to a sample file that triggers this?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Contributor
Posts: 2
Registered: ‎10-25-2011
My Device: Blackberry Torch
My Carrier: AT&T

Re: HELP: DRMException "Unable to parse DRM v2 header"

Thanks for your responses.

 

I have tried to learn how to use "net.rim.device.api.drm.DRMManager" to controll access to a media file that requires a DRM license. I found no documentations or code samples to teahc me how to use the DRMManager APIs except for the document at "http://docs.blackberry.com/en/developers/deliverables/9095/Video_support_447077_11.jsp". I have few questions that I have no answers.

1) What type of DRM license that can be processed by DRMManager APIs (for example Windows DRM license, OMA DRM license, Apple iTunes license, etc)
2) Do I need to write a DRM engine plugged-in to process DRM liceneses in case the DRMManager APIs do not support input DRM licenses.

 

Here are my example code using DRMManager APIs. I use the code to install an OMA license in an XML format and to retireve the license to play a media file. The media file in in mp3 format stored in a local storage of the phone. Both rightsInstall() and getLicenseChallenge() always throw out a DRMException with a message "Unable to parse DRM v2 header"

 

Here is my sample license

 

<o-ex:rights
   xmlnsSmiley Surprised-ex="http://odrl.net/1.1/ODRL-EX"
   xmlnsSmiley Surprised-dd="http://odrl.net/1.1/ODRL-DD"  
xmlns:ds="http://www.w3.org/2000/09/xmldsig#/">
  <o-ex:context>
      <o-dd:version>1.0</o-dd:version>
        </o-ex:context>
  <o-ex:agreement>
    <o-ex:asset>
      <o-ex:context>
        <o-dd:uid>cid:contentURI</o-dd:uid>
      </o-ex:context>
    </o-ex:asset>
    <o-exSmiley Tongueermission>  
      <o-ddSmiley Tonguelay>
      </o-ddSmiley Tonguelay>
    </o-exSmiley Tongueermission>
  </o-ex:agreement>
</o-ex:rights>


Here are my sample codes, The codes consists of 3 parts:

 

Part 1) Implement a DRMRightsInstallCallback interface

 

public class myDRMRightsINstallCallback implements DRMRightsInstallCallback
{


 public public void installOutcome( int outcome )
 {
 ...
 }
}

Part 2) Install a DRM license

DRMManager drmManager = DRMManager.getManager();

try
{
 manager.installRights( contentURI, licenses, new myDRMInstallCallback() )
}
catch( DRMException drmEx)
{
}
catch( ControlledAccessException caEx)
{
}

Parts 3) Retrieve a licenes after installing a license


try
{
 String[] perm = new String[]{DRMManager.PERMISSION_PLAY};
 byte[] license = manager.getLicenseChallenge(contefURI, perm);

}

catch( DRMException drmEx)
{
}
catch( ControlledAccessException caEx)
{
}