Session
A DRM session that's required for a media player track to be prepared.
Public Fields
Drm
The drm this session is associated with.
public DRM Drm { get; set; }
Type | Description |
---|---|
DRM | MediaDRM to obtain the content keys for decrypting protected media streams. |
IsPrepared
Determines if the session is prepared or not.
public bool IsPrepared { get; set; }
Public Methods
MLResult AddKeyValue
CURRENTLY UNTESTED ON CAPI Add a {key, value} pair to the array of {key, value} pairs.
public MLResult AddKeyValue(
KeyValuePair< string, string > pair,
out KeyValuePair< string, string > [] allKeys
)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair< string, string > | pair | |
out KeyValuePair< string, string > [] | allKeys |
MLResult AllocateKeyValueArray
CURRENTLY UNTESTED ON CAPI Allocate array of {key, value} pairs.
public MLResult AllocateKeyValueArray(
uint size,
out KeyValuePair< string, string > [] allKeys
)
Parameters
Type | Name | Description |
---|---|---|
uint | size | |
out KeyValuePair< string, string > [] | allKeys |
MLResult Close
Closes a session that was previously opened.
public MLResult Close()
MLResult Decrypt
CURRENTLY UNTESTED ON CAPI Decrypt the data referenced by input using algorithm if specified, and write the encrypted result into output. The key to use is identified by the 16 byte keyId. The key must have been loaded into the session using MLMediaDRMProvideKeyResponse().
public MLResult Decrypt(
CryptoKeyParam cryptoKeyParam,
byte [] input,
out byte [] output
)
Parameters
Type | Name | Description |
---|---|---|
CryptoKeyParam | cryptoKeyParam | |
byte [] | input | |
out byte [] | output |
MLResult Encrypt
CURRENTLY UNTESTED ON CAPI Encrypt the data referenced by input using algorithm if specified, and write the encrypted result into output. The key to use is identified by the 16 byte keyId. The key must have been loaded into the session using MLMediaDRMProvideKeyResponse().
public MLResult Encrypt(
CryptoKeyParam cryptoKeyParam,
byte [] input,
out byte [] output
)
Parameters
Type | Name | Description |
---|---|---|
CryptoKeyParam | cryptoKeyParam | |
byte [] | input | |
out byte [] | output |
MLResult GetKeyValues
CURRENTLY UNTESTED ON CAPI Request an informative description of the key status for the session. 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.
public MLResult GetKeyValues(
out KeyValuePair< string, string > [] keyValues
)
Parameters
Type | Name | Description |
---|---|---|
out KeyValuePair< string, string > [] | keyValues |
MLResult KeysRequest
A key request/response exchange occurs between the app and a license server to obtain or release keys used to decrypt encrypted content. 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().
public MLResult KeysRequest(
out byte [] requestData
)
Parameters
Type | Name | Description |
---|---|---|
out byte [] | requestData |
MLResult KeysResponse
A key response is received from the license server by the app, then it is provided to the DRM engine plugin using MLMediaDRMProvideKeyResponse(). 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.
public MLResult KeysResponse(
byte [] responseData,
out byte [] keySetData
)
Parameters
Type | Name | Description |
---|---|---|
byte [] | responseData | |
out byte [] | keySetData |
MLResult Open
Opens a new session.
public MLResult Open()
MLResult Prepare
Prepare DRM for the selected media (either audio or video) track with the CurrentSession member.
public MLResult Prepare()
MLResult RemoveKeys
CURRENTLY UNTESTED ON CAPI Remove the current keys from a session.
public MLResult RemoveKeys(
byte [] keySetId
)
Parameters
Type | Name | Description |
---|---|---|
byte [] | keySetId |
MLResult RestoreKeys
CURRENTLY UNTESTED ON CAPI Restore persisted offline keys into a new session. key_set_id identifies the keys to load, obtained from a prior call to MLMediaDRMProvideKeyResponse().
public MLResult RestoreKeys(
byte [] keySetId
)
Parameters
Type | Name | Description |
---|---|---|
byte [] | keySetId |
MLResult Sign
CURRENTLY UNTESTED ON CAPI Generate a signature using the specified algorithm (if provided) over the message data and store the signature. The key to use is identified by the 16 byte keyId. The key must have been loaded into the session using MLMediaDRMProvideKeyResponse().
public MLResult Sign(
HMACParam hmacParam,
byte [] message,
out byte [] signature
)
Parameters
Type | Name | Description |
---|---|---|
HMACParam | hmacParam | |
byte [] | message | |
out byte [] | signature |
MLResult Sign
CURRENTLY UNTESTED ON CAPI Generate a signature using the specified algorithm (if provided) over the message data and store the signature. The key to use is identified by the 16 byte keyId. The key must have been loaded into the session using MLMediaDRMProvideKeyResponse().
public MLResult Sign(
RSAParam rsaParam,
byte [] message,
out byte [] signature
)
Parameters
Type | Name | Description |
---|---|---|
RSAParam | rsaParam | |
byte [] | message | |
out byte [] | signature |
MLResult Verify
CURRENTLY UNTESTED ON CAPI Perform a signature verification using the specified algorithm (if specified) over the message data referenced by the message parameter. The key must have been loaded into the session using MLMediaDRMProvideKeyResponse().
public MLResult Verify(
HMACParam hmacParam,
byte [] message,
byte [] signature,
out bool isMatch
)
Parameters
Type | Name | Description |
---|---|---|
HMACParam | hmacParam | |
byte [] | message | |
byte [] | signature | |
out bool | isMatch |