OMA DRM - aureliendavid/gpac GitHub Wiki
HOME » MP4Box » Encryption » OMA DRM
In order to encrypt a 3GP/MP4 file into a PDCF file, MP4Box uses the same process as ISMA encryption, only the drm file syntax changes.
Just like any XML file, the file must begin with the usual xml header. The file encoding SHALL BE UTF-8. The file is then a collection of OMATrack
elements placed under an OMADRM
document root (currently ignored). Each element describes all OMA DRM information needed to encrypt a given track.
An OMATrack
element may have children describing the optional textual headers defined in OMA DRM 2.0. Each textual header is inserted as is during OMA encryption, so be carefull not to specify twice the same header. More information on textual headers can be found in the OMA (P)DCF specification.
<OMADRM>
<OMATrack trackID="..." key="..." selectiveType="..." rightsIssuerURL="..." contentID="..." transactionID="..." >
<OMATextHeader>textual header</OMATextHeader>
</OMATrack>
</OMADRM>
-
trackID
: specifies the track ID to encrypt. This is a mandatory field, not specifing it will result in an error. -
key
: the AES-128 bit key to use. The key must be specified as an 32 bytes hex string, like 0x2b7e151628aed2a6abf7158809cf4f3c. This is a mandatory field, not specifing it or using an improper length will result in an error. -
rightsIssuerURL
: the URL of the OMA DRM licence server. This is the URL to which an OMA client will request the keys using the ROAP protocol. -
contentID
: a string identifier for the content, passed during ROAP exchanges. -
transactionID
: a string identifier for the transaction, passed during ROAP exchanges. -
selectiveType
: specifies how selective encryption is to be used. The possible values are:- None : no selective encryption, all samples encrypted (this is the default behavior).
-
RAP : only Random Access Samples (key frames) will be encrypted. If all media samples are RAPs, this defaults to
None
. -
Non-RAP : only non-Random Access Samples (non-key frames) will be encrypted. If all media samples are RAPs, this defaults to
None
. - Rand : random selection of samples to encrypt is performed.
-
X : encrypts the first sample every
X
samples.X
must be an integer greater than 2. -
RandX : encrypts one random samples out of
X
samples.X
must be an integer greater than 2.
The following example shows how to encrypt a file with one track, using selective encryption of RAP samples, embedded keys and no IPMP signaling.
<?xml version="1.0" encoding="UTF-8" >
<ISMACryp>
<ISMACrypTrack trackID="1" key="0x2b7e151628aed2a6abf7158809cf4f3c" salt="0xf8f9fafbfcfdfeff" selectiveType="RAP" KMS_URI="self"/>
</ISMACryp>
The following example shows how to encrypt a file with one track, using random encryption over 30 samples, using the source file as KMS URI and IPMP-X signaling.
<?xml version="1.0" encoding="UTF-8" >
<ISMACryp>
<ISMACrypTrack trackID="1" key="0x2b7e151628aed2a6abf7158809cf4f3c" salt="0xf8f9fafbfcfdfeff" selectiveType="Rand30" KMS_URI="file" ipmpType="IPMPX" ipmpDescriptorID="20" />
</ISMACryp>
The following example shows how to encrypt a file with one track, without slective encryption, a KMS URI and no IPMP signaling.
<?xml version="1.0" encoding="UTF-8" >
<ISMACryp>
<ISMACrypTrack trackID="1" key="0x2b7e151628aed2a6abf7158809cf4f3c" salt="0xf8f9fafbfcfdfeff" selectiveType="None" KMS_URI="https://gpac.sourceforge.net/kms/file.xml" />
</ISMACryp>
The following example shows how to encrypt a file with one track, without slective encryption, using OMA DRM.
<?xml version="1.0" encoding="UTF-8" >
<OMADRM>
<OMATrack trackID="1" key="0x2b7e151628aed2a6abf7158809cf4f3c" selectiveType="None" rightsIssuerURL="https://gpac.sourceforge.net/kms" contentID="WatchMe1984" transactionID="14fd12zd3q" >
<OMATextHeader>Preview=instant;http://other.content.com/sonaive</OMATextHeader>
</OMATrack>
</OMADRM>