Skip to main content
Version: 21 Aug 2024

ml_media_drm.h

Classes

Name
structMLMediaDRMByteArray
structMLMediaDRMByteArrayList
structMLMediaDRMKeyValue
structMLMediaDRMKeyValueArray
structMLMediaDRMKeyRequestInputParam
structMLMediaDRMRequestMessage
Data type that encapsulates either of the following along with an URL:
structMLMediaDRMCryptoInputParam
structMLMediaDRMHMACInputParam
structMLMediaDRMRSAInputParam
structMLMediaDRMEventInfo
MediaDRM event info associated with a session.
structMLMediaDRMExpirationUpdateInfo
MediaDRM expiration update info associated with a session.
structMLMediaDRMKeyStatus
MediaDRM key status.
structMLMediaDRMKeyStatusInfo
MediaDRM session keys status change info.
structMLMediaDRMEventCallbacks
Callbacks for notifying client about MLMediaDRM events.

Types

Name
typedef struct MLMediaDRMByteArrayMLMediaDRMByteArray
typedef struct MLMediaDRMByteArrayListMLMediaDRMByteArrayList
typedef struct MLMediaDRMKeyValueMLMediaDRMKeyValue
typedef struct MLMediaDRMKeyValueArrayMLMediaDRMKeyValueArray
typedef struct MLMediaDRMKeyRequestInputParamMLMediaDRMKeyRequestInputParam
typedef struct MLMediaDRMRequestMessageMLMediaDRMRequestMessage
Data type that encapsulates either of the following along with an URL:
typedef struct MLMediaDRMCryptoInputParamMLMediaDRMCryptoInputParam
typedef struct MLMediaDRMHMACInputParamMLMediaDRMHMACInputParam
typedef struct MLMediaDRMRSAInputParamMLMediaDRMRSAInputParam
typedef struct MLMediaDRMEventInfoMLMediaDRMEventInfo
MediaDRM event info associated with a session.
typedef struct MLMediaDRMExpirationUpdateInfoMLMediaDRMExpirationUpdateInfo
MediaDRM expiration update info associated with a session.
typedef struct MLMediaDRMKeyStatusMLMediaDRMKeyStatus
MediaDRM key status.
typedef struct MLMediaDRMKeyStatusInfoMLMediaDRMKeyStatusInfo
MediaDRM session keys status change info.
typedef struct MLMediaDRMEventCallbacksMLMediaDRMEventCallbacks
Callbacks for notifying client about MLMediaDRM events.

Enums

Name
enumMLMediaDRMKeyType
{
MLMediaDRMKeyType_Streaming = 1,
MLMediaDRMKeyType_Offline = 2,
MLMediaDRMKeyType_Release = 3,
MLMediaDRMKeyType_Ensure32Bits = 0x7FFFFFFF
}
enumMLMediaDRMEventType
{
MLMediaDRMEventType_ProvisionRequired = 1,
MLMediaDRMEventType_KeyRequired = 2,
MLMediaDRMEventType_KeyExpired = 3,
MLMediaDRMEventType_VendorDefined = 4,
MLMediaDRMEventType_SessionReclaimed = 5,
MLMediaDRMEventType_ExpirationUpdate = 6,
MLMediaDRMEventType_KeysChange = 7,
MLMediaDRMEventType_Ensure32Bits = 0x7FFFFFFF
}
Request event types.
enumMLMediaDRMKeyStatusCode
{
MLMediaDRMKeyStatusCode_KeyStatusUsable = 0,
MLMediaDRMKeyStatusCode_KeyStatusExpired = 1,
MLMediaDRMKeyStatusCode_KeyStatusOutputNotAllowed = 2,
MLMediaDRMKeyStatusCode_KeyStatusPending = 3,
MLMediaDRMKeyStatusCode_KeyStatusInternalError = 4,
MLMediaDRMKeyStatusCode_Ensure32Bits = 0x7FFFFFFF
}
Status code associated with a DRM session key.

Functions

Name
voidMLMediaDRMEventCallbacksInit(MLMediaDRMEventCallbacks * inout_callbacks)
Initializes MLMediaDRMEventCallbacks with default values.
MLResultMLMediaDRMByteArrayAllocate(size_t size, MLMediaDRMByteArray * out_array)
Allocate byte array buffer.
MLResultMLMediaDRMByteArrayAllocAndCopy(const uint8_t copy_from, size_t size, MLMediaDRMByteArray out_array)
Allocate and Copy to byte array buffer.
MLResultMLMediaDRMKeyValueArrayAllocate(size_t size, MLMediaDRMKeyValueArray * out_array)
Allocate array of key/value pairs.
MLResultMLMediaDRMCreate(MLUUID uuid, MLHandle * out_handle)
Create a MLMediaDRM instance from a UUID.
MLResultMLMediaDRMRelease(MLHandle media_drm)
Release the MLMediaDRM instance.
MLResultMLMediaDRMByteArrayRelease(MLMediaDRMByteArray * array)
Release byte array buffer.
MLResultMLMediaDRMByteArrayListRelease(MLMediaDRMByteArrayList * array)
Release list of byte array buffer.
MLResultMLMediaDRMKeyValueArrayRelease(MLMediaDRMKeyValueArray * array)
Release key/value pair array.
MLResultMLMediaDRMRequestMessageRelease(MLMediaDRMRequestMessage * request)
Release Request Message.
MLResultMLMediaDRMKeyValueArrayAdd(const MLMediaDRMKeyValue pair, MLMediaDRMKeyValueArray out_array)
Add a key/value pair to the array of key/value pairs.
MLResultMLMediaDRMIsCryptoSchemeSupported(MLUUID uuid, const char mime_type, bool out_supported)
Query if the given scheme identified by its UUID is supported on this device. And whether the drm plugin is able to handle the media container format.
MLResultMLMediaDRMSetOnEventListenerEx(MLHandle media_drm, MLMediaDRMEventCallbacks callbacks, void data)
Register a callback to be invoked when DRM events or updates or status change occurs.
MLResultMLMediaDRMOpenSession(MLHandle media_drm, MLMediaDRMByteArray * out_session_id)
Opens a new session. A session ID is returned.
MLResultMLMediaDRMCloseSession(MLHandle media_drm, MLMediaDRMByteArray * session_id)
Closes a session on the MLMediaDRM object that was previously opened with openSession().
MLResultMLMediaDRMGetKeyRequest(MLHandle media_drm, const MLMediaDRMByteArray session_id, const MLMediaDRMKeyRequestInputParam key_request_param, MLMediaDRMRequestMessage * out_key_request)
A key request/response exchange occurs between the app and a license server to obtain or release keys used to decrypt encrypted content.
MLResultMLMediaDRMProvideKeyResponse(MLHandle media_drm, const MLMediaDRMByteArray session_id, const MLMediaDRMByteArray response, MLMediaDRMByteArray * out_key_set_id)
A key response is received from the license server by the app, then it is provided to the DRM engine plugin using MLMediaDRMProvideKeyResponse().
MLResultMLMediaDRMRestoreKeys(MLHandle media_drm, const MLMediaDRMByteArray session_id, const MLMediaDRMByteArray key_set_id)
Restore persisted offline keys into a new session. key_set_id identifies the keys to load, obtained from a prior call to MLMediaDRMProvideKeyResponse().
MLResultMLMediaDRMRemoveKeys(MLHandle media_drm, MLMediaDRMByteArray * key_set_id)
Remove the current keys from a session.
MLResultMLMediaDRMQueryKeyStatus(MLHandle media_drm, const MLMediaDRMByteArray session_id, MLMediaDRMKeyValueArray out_info_map)
Request an informative description of the key status for the session.
MLResultMLMediaDRMGetProvisionRequest(MLHandle media_drm, const char cert_type, MLMediaDRMRequestMessage out_provision_request)
A provision request/response exchange occurs between the app and a provisioning server to retrieve a device certificate.
MLResultMLMediaDRMProvideProvisionResponse(MLHandle media_drm, const MLMediaDRMByteArray response, MLMediaDRMByteArray out_certificate, MLMediaDRMByteArray * out_wrapped_key)
After a provision response is received by the app, it is provided to the DRM engine plugin using this method.
MLResultMLMediaDRMGetSecureStops(MLHandle media_drm, MLMediaDRMByteArrayList * out_secure_stops)
Access all secure stops.
MLResultMLMediaDRMGetSecureStop(MLHandle media_drm, const MLMediaDRMByteArray ss_id, MLMediaDRMByteArray out_secure_stop)
Access secure stop by secure stop ID.
MLResultMLMediaDRMReleaseSecureStops(MLHandle media_drm, const MLMediaDRMByteArray * secure_stop)
Process the SecureStop server response message. After authenticating the message, remove the SecureStops identified in the response. See MLMediaDRMGetSecureStops() for details.
MLResultMLMediaDRMReleaseAllSecureStops(MLHandle media_drm)
Remove all the SecureStops.
MLResultMLMediaDRMGetPropertyString(MLHandle media_drm, MLMediaDRMProperty property_name, char ** out_property_value)
Read a DRM engine plugin String property value, given the property name.
MLResultMLMediaDRMGetPropertyByteArray(MLHandle media_drm, MLMediaDRMProperty property_name, MLMediaDRMByteArray * out_property_value)
Read a DRM engine plugin byte array property value, given the property name.
MLResultMLMediaDRMSetPropertyString(MLHandle media_drm, MLMediaDRMProperty property_name, const char * property_value)
Set a DRM engine plugin String property value.
MLResultMLMediaDRMSetPropertyByteArray(MLHandle media_drm, MLMediaDRMProperty property_name, const MLMediaDRMByteArray * property_value)
Set a DRM engine plugin byte array property value.
MLResultMLMediaDRMEncrypt(MLHandle media_drm, const MLMediaDRMByteArray session_id, const MLMediaDRMCryptoInputParam crypto_key_param, const MLMediaDRMByteArray input, MLMediaDRMByteArray out_output)
Encrypt the data referenced by input using algorithm if specified, and write the encrypted result into output.
MLResultMLMediaDRMDecrypt(MLHandle media_drm, const MLMediaDRMByteArray session_id, const MLMediaDRMCryptoInputParam crypto_key_param, const MLMediaDRMByteArray input, MLMediaDRMByteArray out_output)
Decrypt the data referenced by input using algorithm if specified, and write the encrypted result into output.
MLResultMLMediaDRMSign(MLHandle media_drm, const MLMediaDRMByteArray session_id, const MLMediaDRMHMACInputParam hmac_key_param, const MLMediaDRMByteArray message, MLMediaDRMByteArray out_signature)
Generate a signature using the specified algorithm (if provided) over the message data and store the signature.
MLResultMLMediaDRMVerify(MLHandle media_drm, const MLMediaDRMByteArray session_id, const MLMediaDRMHMACInputParam hmac_key_param, const MLMediaDRMByteArray message, const MLMediaDRMByteArray signature, bool * out_match)
Perform a signature verification using the specified algorithm (if specified) over the message data referenced by the message parameter.
MLResultMLMediaDRMSignRSA(MLHandle media_drm, const MLMediaDRMByteArray session_id, const MLMediaDRMRSAInputParam rsa_key_param, const MLMediaDRMByteArray message, MLMediaDRMByteArray out_signature)
Generate a signature using the specified RSA Key and algorithm.

Attributes

Name
const typedef char *MLMediaDRMProperty
MLMediaDRMPropertyMLMediaDRMProperty_Vendor
MLMediaDRMPropertyMLMediaDRMProperty_Version
MLMediaDRMPropertyMLMediaDRMProperty_Description
MLMediaDRMPropertyMLMediaDRMProperty_Algorithms
String property name: a comma-separated list of cipher and mac algorithms supported by #CryptoSession. The list may be empty if the DRM engine plugin does not support #CryptoSession operations.
MLMediaDRMPropertyMLMediaDRMProperty_DeviceUniqueID
Byte array property name: the device unique identifier is established during device provisioning and provides a means of uniquely identifying each device.

Enums Documentation

MLMediaDRMKeyType

EnumeratorValueDescription
MLMediaDRMKeyType_Streaming1This key request type specifies that the keys will be for online use, they will not be saved to the device for subsequent use when the device is not connected to a network.
MLMediaDRMKeyType_Offline2This key request type specifies that the keys will be for offline use, they will be saved to the device for use when the device is not connected to a network.
MLMediaDRMKeyType_Release3This key request type specifies that previously saved offline keys should be released.
MLMediaDRMKeyType_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Request types.


MLMediaDRMEventType

EnumeratorValueDescription
MLMediaDRMEventType_ProvisionRequired1This event type indicates that the app needs to request a certificate from the provisioning server. The request message data is obtained using MLMediaDRMGetProvisionRequest().
MLMediaDRMEventType_KeyRequired2This event type indicates that the app needs to request keys from a license server. The request message data is obtained using MLMediaDRMGetKeyRequest().
MLMediaDRMEventType_KeyExpired3This event type indicates that the licensed usage duration for keys in a session has expired. The keys are no longer valid.
MLMediaDRMEventType_VendorDefined4This event may indicate some specific vendor-defined condition, see your DRM provider documentation for details.
MLMediaDRMEventType_SessionReclaimed5This event indicates that a session opened by the app has been reclaimed by the resource manager.
MLMediaDRMEventType_ExpirationUpdate6This event is issued when a session expiration update occurs, to inform the app about the change in expiration time. If MLMediaDRMEventCallbacks is setup with a valid on_expiration_update callback, then this event is not notified.
MLMediaDRMEventType_KeysChange7This event is issued when the keys in a session change status, such as when the license is renewed or expires. If MLMediaDRMEventCallbacks is setup with a valid on_key_status_change callback, then this event is not notified.
MLMediaDRMEventType_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Request event types.

API Level:

  • 7

MLMediaDRMKeyStatusCode

EnumeratorValueDescription
MLMediaDRMKeyStatusCode_KeyStatusUsable0The key is currently usable to decrypt media data.
MLMediaDRMKeyStatusCode_KeyStatusExpired1The key is no longer usable to decrypt media data because its expiration time has passed.
MLMediaDRMKeyStatusCode_KeyStatusOutputNotAllowed2The key is not currently usable to decrypt media data because its output requirements cannot currently be met.
MLMediaDRMKeyStatusCode_KeyStatusPending3The status of the key is not yet known and is being determined. The status will be updated with the actual status when it has been determined.
MLMediaDRMKeyStatusCode_KeyStatusInternalError4The key is not currently usable to decrypt media data because of an internal error in processing unrelated to input parameters. This error is not actionable by an app.
MLMediaDRMKeyStatusCode_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Status code associated with a DRM session key.

API Level:

  • 20

Types Documentation

MLMediaDRMByteArray

typedef struct MLMediaDRMByteArray MLMediaDRMByteArray;

Data type containing byte array buffer and the size.

More Info


MLMediaDRMByteArrayList

typedef struct MLMediaDRMByteArrayList MLMediaDRMByteArrayList;

Data type containing list of byte array buffers and the size.

More Info


MLMediaDRMKeyValue

typedef struct MLMediaDRMKeyValue MLMediaDRMKeyValue;

Data type containing key/value pair.

More Info


MLMediaDRMKeyValueArray

typedef struct MLMediaDRMKeyValueArray MLMediaDRMKeyValueArray;

Data type containing array of key/value pair.

More Info


MLMediaDRMKeyRequestInputParam

typedef struct MLMediaDRMKeyRequestInputParam MLMediaDRMKeyRequestInputParam;

Data type that encapsulates Key Request input arguments.

More Info


MLMediaDRMRequestMessage

typedef struct MLMediaDRMRequestMessage MLMediaDRMRequestMessage;

Data type that encapsulates either of the following along with an URL:

For Key Request Message: an opaque key request byte array that should be delivered to the license server.

For Provision Request Message: an opaque provision request byte array that should be delivered to the provisioning server.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMCryptoInputParam

typedef struct MLMediaDRMCryptoInputParam MLMediaDRMCryptoInputParam;

Data type that encapsulates algorithm, key_set_id and IV for Encryption/Decryption.

More Info


MLMediaDRMHMACInputParam

typedef struct MLMediaDRMHMACInputParam MLMediaDRMHMACInputParam;

Data type that encapsulates algorithm, key_set_id for HMAC based Sign/Verify.

More Info


MLMediaDRMRSAInputParam

typedef struct MLMediaDRMRSAInputParam MLMediaDRMRSAInputParam;

Data type that encapsulates algorithm, wrapped_key for RSA operation.

More Info


MLMediaDRMEventInfo

typedef struct MLMediaDRMEventInfo MLMediaDRMEventInfo;

MediaDRM event info associated with a session.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 20

MLMediaDRMExpirationUpdateInfo

typedef struct MLMediaDRMExpirationUpdateInfo MLMediaDRMExpirationUpdateInfo;

MediaDRM expiration update info associated with a session.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 20

MLMediaDRMKeyStatus

typedef struct MLMediaDRMKeyStatus MLMediaDRMKeyStatus;

MediaDRM key status.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 20

MLMediaDRMKeyStatusInfo

typedef struct MLMediaDRMKeyStatusInfo MLMediaDRMKeyStatusInfo;

MediaDRM session keys status change info.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 20

MLMediaDRMEventCallbacks

typedef struct MLMediaDRMEventCallbacks MLMediaDRMEventCallbacks;

Callbacks for notifying client about MLMediaDRM events.

User of MLMediaDRM should implement this.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 20

Functions Documentation

MLMediaDRMEventCallbacksInit

static inline void MLMediaDRMEventCallbacksInit(
MLMediaDRMEventCallbacks * inout_callbacks
)

Initializes MLMediaDRMEventCallbacks with default values.

Parameters

MLMediaDRMEventCallbacks *inout_callbacksMediaDRM Callback structure defined by MLMediaDRMEventCallbacks that needs to be initialized.
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMByteArrayAllocate

MLResult MLMediaDRMByteArrayAllocate(
size_t size,
MLMediaDRMByteArray * out_array
)

Allocate byte array buffer.

Parameters

size_tsizeMaximum size of the desirable byte array to be allocated.
MLMediaDRMByteArray *out_arrayPointer to byte array buffer that needs to be allocated. To free/release, call MLMediaDRMByteArrayRelease().

Returns

MLResultMLResult_AllocFailedFailed because of allocation failure.
MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkByte Array is allocated successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMByteArrayAllocAndCopy

MLResult MLMediaDRMByteArrayAllocAndCopy(
const uint8_t * copy_from,
size_t size,
MLMediaDRMByteArray * out_array
)

Allocate and Copy to byte array buffer.

Parameters

const uint8_t *copy_fromBuffer from which copy into byte array.
size_tsizeNumber of bytes to be copied.
MLMediaDRMByteArray *out_arrayPointer to byte array buffer that needs to be allocated and copied to. To free/release, call MLMediaDRMByteArrayRelease().

Returns

MLResultMLResult_AllocFailedFailed because of allocation failure.
MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkByte Array is allocated and copied successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMKeyValueArrayAllocate

MLResult MLMediaDRMKeyValueArrayAllocate(
size_t size,
MLMediaDRMKeyValueArray * out_array
)

Allocate array of key/value pairs.

Parameters

size_tsizeMaximum size of the desirable array of key/value pair to be allocated.
MLMediaDRMKeyValueArray *out_arrayPointer to array of key/value pair that needs to be allocated. To free/release, call MLMediaDRMKeyValueArrayRelease().

Returns

MLResultMLResult_AllocFailedFailed because of allocation failure.
MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkKey/value pair array is allocated successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMCreate

MLResult MLMediaDRMCreate(
MLUUID uuid,
MLHandle * out_handle
)

Create a MLMediaDRM instance from a UUID.

Parameters

MLUUIDuuidThe universal unique ID of the crypto scheme. uuid must be 16 bytes.
MLHandle *out_handleUpon successful return will point to handle to the created MLMediaDRM. Or else, it will point to ML_INVALID_HANDLE.

Returns

MLResultMLResult_AllocFailedMLMediaDRM object creation failed with resource allocation failure.
MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkMLMediaDRM object was created successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMRelease

MLResult MLMediaDRMRelease(
MLHandle media_drm
)

Release the MLMediaDRM instance.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.

Returns

MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkMLMediaDRM object was released successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMByteArrayRelease

MLResult MLMediaDRMByteArrayRelease(
MLMediaDRMByteArray * array
)

Release byte array buffer.

Parameters

MLMediaDRMByteArray *arrayByte array buffer that needs to be released.

Returns

MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkByte Array was released successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMByteArrayListRelease

MLResult MLMediaDRMByteArrayListRelease(
MLMediaDRMByteArrayList * array
)

Release list of byte array buffer.

Parameters

MLMediaDRMByteArrayList *arrayList of byte array buffer that needs to be released.

Returns

MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkByte Array List was released successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMKeyValueArrayRelease

MLResult MLMediaDRMKeyValueArrayRelease(
MLMediaDRMKeyValueArray * array
)

Release key/value pair array.

Parameters

MLMediaDRMKeyValueArray *arrayKey/value pair array that needs to be released.

Returns

MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkKey/value pair array was released successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMRequestMessageRelease

MLResult MLMediaDRMRequestMessageRelease(
MLMediaDRMRequestMessage * request
)

Release Request Message.

Parameters

MLMediaDRMRequestMessage *requestPointer to Request Message that needs to be released.

Returns

MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_OkDRM Request Message was released successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMKeyValueArrayAdd

MLResult MLMediaDRMKeyValueArrayAdd(
const MLMediaDRMKeyValue * pair,
MLMediaDRMKeyValueArray * out_array
)

Add a key/value pair to the array of key/value pairs.

Parameters

const MLMediaDRMKeyValue *pairThe source key/value pair that needs to be added.
MLMediaDRMKeyValueArray *out_arrayPointer to array of key/value pair to which the pair needs to be added to.

Returns

MLResultMLResult_InvalidParamOne of the parameters is invalid.
MLResultMLResult_Okkey/value pair is added successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMIsCryptoSchemeSupported

MLResult MLMediaDRMIsCryptoSchemeSupported(
MLUUID uuid,
const char * mime_type,
bool * out_supported
)

Query if the given scheme identified by its UUID is supported on this device. And whether the drm plugin is able to handle the media container format.

Parameters

MLUUIDuuidIdentifies the universal unique ID of the crypto scheme. UUID must be 16 bytes.
const char *mime_typeThe MIME type of the media container, e.g. "video/mp4". If mime_type is not known or required, it can be provided as NULL.
bool *out_supportedOn successful return contains true or false based on whether the given crypto scheme is supported or not.

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkThe query has run successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMSetOnEventListenerEx

MLResult MLMediaDRMSetOnEventListenerEx(
MLHandle media_drm,
MLMediaDRMEventCallbacks * callbacks,
void * data
)

Register a callback to be invoked when DRM events or updates or status change occurs.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
MLMediaDRMEventCallbacks *callbacksSet of event callbacks. Can be set to NULL to unset the callbacks altogether.
void *dataCustom data to be returned when any callback is fired.

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkEvent listener was set successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 20

MLMediaDRMOpenSession

MLResult MLMediaDRMOpenSession(
MLHandle media_drm,
MLMediaDRMByteArray * out_session_id
)

Opens a new session. A session ID is returned.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
MLMediaDRMByteArray *out_session_idID of the session created/opened. This byte array will be released when MLMediaDRMCloseSession() is called.

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM session was opened successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMCloseSession

MLResult MLMediaDRMCloseSession(
MLHandle media_drm,
MLMediaDRMByteArray * session_id
)

Closes a session on the MLMediaDRM object that was previously opened with openSession().

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
MLMediaDRMByteArray *session_idThe session ID for the DRM session, which will be released on return.

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM session was closed successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMGetKeyRequest

MLResult MLMediaDRMGetKeyRequest(
MLHandle media_drm,
const MLMediaDRMByteArray * session_id,
const MLMediaDRMKeyRequestInputParam * key_request_param,
MLMediaDRMRequestMessage * out_key_request
)

A key request/response exchange occurs between the app and a license server to obtain or release keys used to decrypt encrypted content.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
const MLMediaDRMByteArray *session_idThe session ID for the DRM session.
const MLMediaDRMKeyRequestInputParam *key_request_paramPlaceholder for needed arguments for generating a key request message.
MLMediaDRMRequestMessage *out_key_requestUpon successful return, contains key request message. To free/release this, call MLMediaDRMRequestMessageRelease().

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM Key Request message is constructed successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

MLMediaDRMGetKeyRequest() is used to obtain an opaque key request byte array that is delivered to the license server. The opaque key request byte array is returned in out_key_request.request The recommended URL to deliver the key request to is returned in out_key_request.default_URL.

After the app has received the key request response from the server, it should deliver to the response to the DRM engine plugin using the method MLMediaDRMProvideKeyResponse().

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMProvideKeyResponse

MLResult MLMediaDRMProvideKeyResponse(
MLHandle media_drm,
const MLMediaDRMByteArray * session_id,
const MLMediaDRMByteArray * response,
MLMediaDRMByteArray * out_key_set_id
)

A key response is received from the license server by the app, then it is provided to the DRM engine plugin using MLMediaDRMProvideKeyResponse().

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
const MLMediaDRMByteArray *session_idThe session ID for the DRM session.
const MLMediaDRMByteArray *responseThe opaque response from the server.
MLMediaDRMByteArray *out_key_set_idUpon successful return, contains the key identifier. To free/release this buffer, call MLMediaDRMByteArrayRelease().

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM Key Response message was consumed successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

When the response is for an offline key request, a key_set_id is returned that can be used to later restore the keys to a new session with restoreKeys(). When the response is for a streaming or release request, a null key_set_id is returned.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMRestoreKeys

MLResult MLMediaDRMRestoreKeys(
MLHandle media_drm,
const MLMediaDRMByteArray * session_id,
const MLMediaDRMByteArray * key_set_id
)

Restore persisted offline keys into a new session. key_set_id identifies the keys to load, obtained from a prior call to MLMediaDRMProvideKeyResponse().

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
const MLMediaDRMByteArray *session_idThe session ID for the DRM session.
const MLMediaDRMByteArray *key_set_idThe saved key set to restore.

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM Keys are restored successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMRemoveKeys

MLResult MLMediaDRMRemoveKeys(
MLHandle media_drm,
MLMediaDRMByteArray * key_set_id
)

Remove the current keys from a session.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
MLMediaDRMByteArray *key_set_idThe keys to remove, which will be released on success.

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM Keys are removed successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMQueryKeyStatus

MLResult MLMediaDRMQueryKeyStatus(
MLHandle media_drm,
const MLMediaDRMByteArray * session_id,
MLMediaDRMKeyValueArray * out_info_map
)

Request an informative description of the key status for the session.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
const MLMediaDRMByteArray *session_idThe session ID for the DRM session.
MLMediaDRMKeyValueArray *out_info_mapThe Key-Value pair place-holder for the key status. To release/free this call MLMediaDRMKeyValueArrayRelease().

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkQuery for MLMediaDRM Key status completed successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

The status is in the form of key/value pairs. Since DRM license policies vary by vendor, the specific status field names are determined by each DRM vendor. Refer to your DRM provider documentation for definitions of the field names for a particular DRM engine plugin.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMGetProvisionRequest

MLResult MLMediaDRMGetProvisionRequest(
MLHandle media_drm,
const char * cert_type,
MLMediaDRMRequestMessage * out_provision_request
)

A provision request/response exchange occurs between the app and a provisioning server to retrieve a device certificate.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
const char *cert_typeThe device certificate type, which can be "none" or "X.509".
MLMediaDRMRequestMessage *out_provision_requestUpon successful return, contains provision request message. To free/release this, call MLMediaDRMRequestMessageRelease().

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkDevice Provision Request message is constructed successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

If provisioning is required, the #EVENT_PROVISION_REQUIRED event will be sent to the event handler. MLMediaDRMGetProvisionRequest() is used to obtain the opaque provision request byte array that should be delivered to the provisioning server.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMProvideProvisionResponse

MLResult MLMediaDRMProvideProvisionResponse(
MLHandle media_drm,
const MLMediaDRMByteArray * response,
MLMediaDRMByteArray * out_certificate,
MLMediaDRMByteArray * out_wrapped_key
)

After a provision response is received by the app, it is provided to the DRM engine plugin using this method.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
const MLMediaDRMByteArray *responseThe opaque provisioning response byte array to provide to the DRM engine plugin.
MLMediaDRMByteArray *out_certificateThe device certificate upon sucessful return. To release/free this call MLMediaDRMByteArrayRelease().
MLMediaDRMByteArray *out_wrapped_keyThe wrapped device key upon sucessful return. To release/free this call MLMediaDRMByteArrayRelease().

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkDevice Provision Response message is consumed successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMGetSecureStops

MLResult MLMediaDRMGetSecureStops(
MLHandle media_drm,
MLMediaDRMByteArrayList * out_secure_stops
)

Access all secure stops.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
MLMediaDRMByteArrayList *out_secure_stopsList of all the secure stops upon successful return. To free/release call MLMediaDRMByteArrayListRelease().

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM Secure stops are retrieved successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

Secure Stop:

A means of enforcing limits on the number of concurrent streams per subscriber across devices is provided via #SecureStop. This is achieved by securely monitoring the lifetime of sessions.

Information from the server related to the current playback session is written to persistent storage on the device when each #MediaCrypto object is created.

In the normal case, playback will be completed, the session destroyed and the Secure Stops will be queried. The app queries secure stops and forwards the secure stop message to the server which verifies the signature and notifies the server side database that the session destruction has been confirmed.

The persisted record on the client is only removed after positive confirmation that the server received the message using releaseSecureStops().

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMGetSecureStop

MLResult MLMediaDRMGetSecureStop(
MLHandle media_drm,
const MLMediaDRMByteArray * ss_id,
MLMediaDRMByteArray * out_secure_stop
)

Access secure stop by secure stop ID.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
const MLMediaDRMByteArray *ss_idThe ID for the DRM securestop session.
MLMediaDRMByteArray *out_secure_stopThe secure stop upon successful return. To free/release call MLMediaDRMByteArrayRelease().

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM Secure stop is retrieved successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

See: MLMediaDRMGetSecureStops().


MLMediaDRMReleaseSecureStops

MLResult MLMediaDRMReleaseSecureStops(
MLHandle media_drm,
const MLMediaDRMByteArray * secure_stop
)

Process the SecureStop server response message. After authenticating the message, remove the SecureStops identified in the response. See MLMediaDRMGetSecureStops() for details.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
const MLMediaDRMByteArray *secure_stopThe server response indicating which secure stops to release.

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM Secure stops are released successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMReleaseAllSecureStops

MLResult MLMediaDRMReleaseAllSecureStops(
MLHandle media_drm
)

Remove all the SecureStops.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkAll secure stops for the MLMediaDRM are released successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

See: MLMediaDRMGetSecureStops().


MLMediaDRMGetPropertyString

MLResult MLMediaDRMGetPropertyString(
MLHandle media_drm,
MLMediaDRMProperty property_name,
char ** out_property_value
)

Read a DRM engine plugin String property value, given the property name.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
MLMediaDRMPropertyproperty_nameThe property to query. Standard property names are:

* MLMediaDRMProperty_Vendor. * MLMediaDRMProperty_Version. * MLMediaDRMProperty_Description. * MLMediaDRMProperty_Algorithms. | | char ** |out_property_value|The property value upon successful return. Ownership is passed, call free(*out_property_value) to free it.|

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM property is retrieved successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMGetPropertyByteArray

MLResult MLMediaDRMGetPropertyByteArray(
MLHandle media_drm,
MLMediaDRMProperty property_name,
MLMediaDRMByteArray * out_property_value
)

Read a DRM engine plugin byte array property value, given the property name.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
MLMediaDRMPropertyproperty_nameThe property to query. Standard property names are:

* MLMediaDRMProperty_DeviceUniqueID. | | MLMediaDRMByteArray * |out_property_value|The property value upon successful return. To release/free call MLMediaDRMByteArrayRelease().|

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM property is retrieved successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMSetPropertyString

MLResult MLMediaDRMSetPropertyString(
MLHandle media_drm,
MLMediaDRMProperty property_name,
const char * property_value
)

Set a DRM engine plugin String property value.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
MLMediaDRMPropertyproperty_nameThe property to query. Standard property names are:

* MLMediaDRMProperty_Vendor. * MLMediaDRMProperty_Version. * MLMediaDRMProperty_Description. * MLMediaDRMProperty_Algorithms. | | const char * |property_value|The value of the corresponding property.|

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM property is set successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMSetPropertyByteArray

MLResult MLMediaDRMSetPropertyByteArray(
MLHandle media_drm,
MLMediaDRMProperty property_name,
const MLMediaDRMByteArray * property_value
)

Set a DRM engine plugin byte array property value.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
MLMediaDRMPropertyproperty_nameThe property to query. Standard property names are:

* MLMediaDRMProperty_DeviceUniqueID. | | const MLMediaDRMByteArray * |property_value|The value of the corresponding property.|

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM property is set successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMEncrypt

MLResult MLMediaDRMEncrypt(
MLHandle media_drm,
const MLMediaDRMByteArray * session_id,
const MLMediaDRMCryptoInputParam * crypto_key_param,
const MLMediaDRMByteArray * input,
MLMediaDRMByteArray * out_output
)

Encrypt the data referenced by input using algorithm if specified, and write the encrypted result into output.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
const MLMediaDRMByteArray *session_idThe session ID for the DRM session.
const MLMediaDRMCryptoInputParam *crypto_key_paramPointer to the structure that contains needed crypto arguments for encryption operation.
const MLMediaDRMByteArray *inputThe data that needs to be encrypted.
MLMediaDRMByteArray *out_outputThe encrypted input upon successful return. To free/release this buffer, call MLMediaDRMByteArrayRelease().

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM encryption operation has been completed successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

The key to use is identified by the 16 byte keyId. The key must have been loaded into the session using MLMediaDRMProvideKeyResponse().

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMDecrypt

MLResult MLMediaDRMDecrypt(
MLHandle media_drm,
const MLMediaDRMByteArray * session_id,
const MLMediaDRMCryptoInputParam * crypto_key_param,
const MLMediaDRMByteArray * input,
MLMediaDRMByteArray * out_output
)

Decrypt the data referenced by input using algorithm if specified, and write the encrypted result into output.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
const MLMediaDRMByteArray *session_idThe session ID for the DRM session.
const MLMediaDRMCryptoInputParam *crypto_key_paramPointer to the structure that contains needed crypto arguments for decryption operation.
const MLMediaDRMByteArray *inputThe data that needs to be decrypted.
MLMediaDRMByteArray *out_outputThe decrypted input upon successful return. To free/release this buffer, call MLMediaDRMByteArrayRelease().

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM decryption operation has been completed successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

The key to use is identified by the 16 byte keyId. The key must have been loaded into the session using MLMediaDRMProvideKeyResponse().

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMSign

MLResult MLMediaDRMSign(
MLHandle media_drm,
const MLMediaDRMByteArray * session_id,
const MLMediaDRMHMACInputParam * hmac_key_param,
const MLMediaDRMByteArray * message,
MLMediaDRMByteArray * out_signature
)

Generate a signature using the specified algorithm (if provided) over the message data and store the signature.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
const MLMediaDRMByteArray *session_idThe session ID for the DRM session.
const MLMediaDRMHMACInputParam *hmac_key_paramPointer to the structure that contains needed crypto arguments for HMAC operation.
const MLMediaDRMByteArray *messageThe data that needs to be signed.
MLMediaDRMByteArray *out_signatureThe signature of the input message upon success. To free/release this buffer, call MLMediaDRMByteArrayRelease().

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM HMAC Sign operation has been completed successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

The key to use is identified by the 16 byte keyId. The key must have been loaded into the session using MLMediaDRMProvideKeyResponse().

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMVerify

MLResult MLMediaDRMVerify(
MLHandle media_drm,
const MLMediaDRMByteArray * session_id,
const MLMediaDRMHMACInputParam * hmac_key_param,
const MLMediaDRMByteArray * message,
const MLMediaDRMByteArray * signature,
bool * out_match
)

Perform a signature verification using the specified algorithm (if specified) over the message data referenced by the message parameter.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
const MLMediaDRMByteArray *session_idThe session ID for the DRM session.
const MLMediaDRMHMACInputParam *hmac_key_paramPointer to the structure that contains needed crypto arguments for HMAC operation.
const MLMediaDRMByteArray *messageThe data for which signature needs to be verified.
const MLMediaDRMByteArray *signatureThe signature of the input message.
bool *out_matchPointer to bool, which would return "true" if the signature matches, "false" otherwise.

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM HMAC Verify operation has been completed successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

The key must have been loaded into the session using MLMediaDRMProvideKeyResponse().

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMSignRSA

MLResult MLMediaDRMSignRSA(
MLHandle media_drm,
const MLMediaDRMByteArray * session_id,
const MLMediaDRMRSAInputParam * rsa_key_param,
const MLMediaDRMByteArray * message,
MLMediaDRMByteArray * out_signature
)

Generate a signature using the specified RSA Key and algorithm.

Parameters

MLHandlemedia_drmHandle to the MLMediaDRM.
const MLMediaDRMByteArray *session_idThe session ID for the DRM session.
const MLMediaDRMRSAInputParam *rsa_key_paramPointer to the structure that contains needed key arguments for this RSA operation.
const MLMediaDRMByteArray *messageThe data that needs to be signed.
MLMediaDRMByteArray *out_signatureThe signature of the input message upon success. To free/release this buffer, call MLMediaDRMByteArrayRelease().

Returns

MLResultMLResult_InvalidParamParameter is invalid.
MLResultMLResult_OkMLMediaDRM RSA Sign operation has been completed successfully.
MLResultMLResult_PermissionDeniedNecessary permission is missing.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


Attributes Documentation

MLMediaDRMProperty

const typedef char * MLMediaDRMProperty;

MLMediaDRMProperty_Vendor

MLMediaDRMProperty MLMediaDRMProperty_Vendor;

String property name: identifies the maker of the DRM engine plugin.


MLMediaDRMProperty_Version

MLMediaDRMProperty MLMediaDRMProperty_Version;

String property name: identifies the version of the DRM engine plugin.


MLMediaDRMProperty_Description

MLMediaDRMProperty MLMediaDRMProperty_Description;

String property name: describes the DRM engine plugin.


MLMediaDRMProperty_Algorithms

MLMediaDRMProperty MLMediaDRMProperty_Algorithms;

String property name: a comma-separated list of cipher and mac algorithms supported by #CryptoSession. The list may be empty if the DRM engine plugin does not support #CryptoSession operations.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaDRMProperty_DeviceUniqueID

MLMediaDRMProperty MLMediaDRMProperty_DeviceUniqueID;

Byte array property name: the device unique identifier is established during device provisioning and provides a means of uniquely identifying each device.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


Source code

// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) 2017 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement,
// located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying
// this distribution may also be found in the top-level NOTICE file
// appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%

#pragma once

#include "ml_api.h"
#include "ml_types.h"

ML_EXTERN_C_BEGIN

typedef const char *MLMediaDRMProperty;

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API extern MLMediaDRMProperty MLMediaDRMProperty_Vendor;

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API extern MLMediaDRMProperty MLMediaDRMProperty_Version;

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API extern MLMediaDRMProperty MLMediaDRMProperty_Description;

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API extern MLMediaDRMProperty MLMediaDRMProperty_Algorithms;

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API extern MLMediaDRMProperty MLMediaDRMProperty_DeviceUniqueID;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMByteArray {
uint8_t *ptr;
size_t length;
} MLMediaDRMByteArray;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMByteArrayList {
MLMediaDRMByteArray *ptr;
size_t length;
} MLMediaDRMByteArrayList;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMKeyValue {
const char *key;
const char *value;
} MLMediaDRMKeyValue;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMKeyValueArray {
MLMediaDRMKeyValue *ptr;
size_t length;
size_t index;
} MLMediaDRMKeyValueArray;

typedef enum MLMediaDRMKeyType {
MLMediaDRMKeyType_Streaming = 1,
MLMediaDRMKeyType_Offline = 2,
MLMediaDRMKeyType_Release = 3,
MLMediaDRMKeyType_Ensure32Bits = 0x7FFFFFFF
} MLMediaDRMKeyType;

typedef enum MLMediaDRMEventType {
MLMediaDRMEventType_ProvisionRequired = 1,
MLMediaDRMEventType_KeyRequired = 2,
MLMediaDRMEventType_KeyExpired = 3,
MLMediaDRMEventType_VendorDefined = 4,
MLMediaDRMEventType_SessionReclaimed = 5,
MLMediaDRMEventType_ExpirationUpdate = 6,
MLMediaDRMEventType_KeysChange = 7,
MLMediaDRMEventType_Ensure32Bits = 0x7FFFFFFF
} MLMediaDRMEventType;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMKeyRequestInputParam {
MLMediaDRMByteArray *init_data;
char *mime_type;
MLMediaDRMKeyType key_type;
MLMediaDRMKeyValueArray *optional_params;
} MLMediaDRMKeyRequestInputParam;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMRequestMessage {
MLMediaDRMByteArray request;
char *default_URL;
} MLMediaDRMRequestMessage;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMCryptoInputParam {
char *algorithm;
MLMediaDRMByteArray *key_set_id;
MLMediaDRMByteArray *iv;
} MLMediaDRMCryptoInputParam;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMHMACInputParam {
char *algorithm;
MLMediaDRMByteArray *key_set_id;
} MLMediaDRMHMACInputParam;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMRSAInputParam {
char *algorithm;
MLMediaDRMByteArray *wrapped_rsa_key;
} MLMediaDRMRSAInputParam;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMEventInfo {
MLMediaDRMByteArray *session_id;
MLMediaDRMEventType event_type;
int extra;
MLMediaDRMByteArray *event_data;
void *data;
} MLMediaDRMEventInfo;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMExpirationUpdateInfo {
MLMediaDRMByteArray *session_id;
uint64_t expiration_time_ms;
void *data;
} MLMediaDRMExpirationUpdateInfo;

typedef enum MLMediaDRMKeyStatusCode {
MLMediaDRMKeyStatusCode_KeyStatusUsable = 0,

MLMediaDRMKeyStatusCode_KeyStatusExpired = 1,

MLMediaDRMKeyStatusCode_KeyStatusOutputNotAllowed = 2,

MLMediaDRMKeyStatusCode_KeyStatusPending = 3,

MLMediaDRMKeyStatusCode_KeyStatusInternalError = 4,

MLMediaDRMKeyStatusCode_Ensure32Bits = 0x7FFFFFFF
} MLMediaDRMKeyStatusCode;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMKeyStatus {
MLMediaDRMByteArray key_id;
MLMediaDRMKeyStatusCode status_code;
} MLMediaDRMKeyStatus;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMKeyStatusInfo {
MLMediaDRMByteArray *session_id;
size_t key_status_count;
MLMediaDRMKeyStatus *key_status;
bool has_new_usable_key;
void *data;
} MLMediaDRMKeyStatusInfo;

typedef ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.") struct MLMediaDRMEventCallbacks {
uint32_t version;

void (*on_event)(MLHandle media_drm, const MLMediaDRMEventInfo *event_info);

void (*on_expiration_update)(MLHandle media_drm, const MLMediaDRMExpirationUpdateInfo *update_info);

void (*on_key_status_change)(MLHandle media_drm, const MLMediaDRMKeyStatusInfo *key_status_info);
} MLMediaDRMEventCallbacks;

ML_STATIC_INLINE void MLMediaDRMEventCallbacksInit(MLMediaDRMEventCallbacks *inout_callbacks) {
if (inout_callbacks) {
inout_callbacks->version = 1;
inout_callbacks->on_event = NULL;
inout_callbacks->on_expiration_update = NULL;
inout_callbacks->on_key_status_change = NULL;
}
}

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMByteArrayAllocate(size_t size, MLMediaDRMByteArray *out_array);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMByteArrayAllocAndCopy(const uint8_t *copy_from, size_t size, MLMediaDRMByteArray *out_array);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMKeyValueArrayAllocate(size_t size, MLMediaDRMKeyValueArray *out_array);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMCreate(MLUUID uuid, MLHandle *out_handle);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMRelease(MLHandle media_drm);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMByteArrayRelease(MLMediaDRMByteArray *array);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMByteArrayListRelease(MLMediaDRMByteArrayList *array);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMKeyValueArrayRelease(MLMediaDRMKeyValueArray *array);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMRequestMessageRelease(MLMediaDRMRequestMessage *request);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMKeyValueArrayAdd(const MLMediaDRMKeyValue *pair, MLMediaDRMKeyValueArray *out_array);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMIsCryptoSchemeSupported(MLUUID uuid, const char *mime_type, bool *out_supported);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMSetOnEventListenerEx(MLHandle media_drm, MLMediaDRMEventCallbacks *callbacks, void *data);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMOpenSession(MLHandle media_drm, MLMediaDRMByteArray *out_session_id);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMCloseSession(MLHandle media_drm, MLMediaDRMByteArray *session_id);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMGetKeyRequest(MLHandle media_drm, const MLMediaDRMByteArray *session_id, const MLMediaDRMKeyRequestInputParam *key_request_param, MLMediaDRMRequestMessage *out_key_request);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMProvideKeyResponse(MLHandle media_drm, const MLMediaDRMByteArray *session_id, const MLMediaDRMByteArray *response, MLMediaDRMByteArray *out_key_set_id);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMRestoreKeys(MLHandle media_drm, const MLMediaDRMByteArray *session_id, const MLMediaDRMByteArray *key_set_id);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMRemoveKeys(MLHandle media_drm, MLMediaDRMByteArray *key_set_id);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMQueryKeyStatus(MLHandle media_drm, const MLMediaDRMByteArray *session_id, MLMediaDRMKeyValueArray *out_info_map);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMGetProvisionRequest(MLHandle media_drm, const char *cert_type, MLMediaDRMRequestMessage *out_provision_request);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMProvideProvisionResponse(MLHandle media_drm, const MLMediaDRMByteArray *response, MLMediaDRMByteArray *out_certificate, MLMediaDRMByteArray *out_wrapped_key);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMGetSecureStops(MLHandle media_drm, MLMediaDRMByteArrayList *out_secure_stops);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMGetSecureStop(MLHandle media_drm, const MLMediaDRMByteArray *ss_id, MLMediaDRMByteArray *out_secure_stop);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMReleaseSecureStops(MLHandle media_drm, const MLMediaDRMByteArray *secure_stop);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMReleaseAllSecureStops(MLHandle media_drm);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMGetPropertyString(MLHandle media_drm, MLMediaDRMProperty property_name, char **out_property_value);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMGetPropertyByteArray(MLHandle media_drm, MLMediaDRMProperty property_name, MLMediaDRMByteArray *out_property_value);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMSetPropertyString(MLHandle media_drm, MLMediaDRMProperty property_name, const char *property_value);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMSetPropertyByteArray(MLHandle media_drm, MLMediaDRMProperty property_name, const MLMediaDRMByteArray *property_value);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMEncrypt(MLHandle media_drm, const MLMediaDRMByteArray *session_id, const MLMediaDRMCryptoInputParam *crypto_key_param, const MLMediaDRMByteArray *input, MLMediaDRMByteArray *out_output);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMDecrypt(MLHandle media_drm, const MLMediaDRMByteArray *session_id, const MLMediaDRMCryptoInputParam *crypto_key_param, const MLMediaDRMByteArray *input, MLMediaDRMByteArray *out_output);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMSign(MLHandle media_drm, const MLMediaDRMByteArray *session_id, const MLMediaDRMHMACInputParam *hmac_key_param, const MLMediaDRMByteArray *message, MLMediaDRMByteArray *out_signature);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMVerify(MLHandle media_drm, const MLMediaDRMByteArray *session_id, const MLMediaDRMHMACInputParam *hmac_key_param, const MLMediaDRMByteArray *message, const MLMediaDRMByteArray *signature, bool *out_match);

ML_DEPRECATED_MSG("Use standard Android SDK and NDK APIs.")
ML_API MLResult ML_CALL MLMediaDRMSignRSA(MLHandle media_drm, const MLMediaDRMByteArray *session_id, const MLMediaDRMRSAInputParam *rsa_key_param, const MLMediaDRMByteArray *message, MLMediaDRMByteArray *out_signature);

ML_EXTERN_C_END