ifDeviceCrypto
Implemented By
| Name | Description |
|---|---|
| roDeviceCrypto | Encrypts and decrypts data on a device using a key that is unique per app, device, or model. |
Supported Methods
Encrypt (input as roByteArray, String as encType) as roByteArray
Description
Encrypts data on a device that is unique per device, app, or model.
Parameters
| Name | Type | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| input | roByteArray | The data to be encrypted. | ||||||||
| encType | String | The encryption key type, which is a string that may be set to "channel", "device", or "model":
|
Return Value
An roByteArray containing the encrypted data.
Decrypt (EncryptedData as roByteArray, String as encType) as roByteArray
Description
Decrypts data stored on a device that was previously encoded with the Encrypt() method.
Parameters
| Name | Type | Description |
|---|---|---|
| EncryptedData | roByteArray | The previously encoded data to be decrypted. |
| encType | String | The encryption key type, which is a string that may be set to "channel", "device", or "model" (see table below for details). |
Return Value
An roByteArray containing the decrypted data.
Example
You can use the Encrypt() and Decrypt() methods to encrypt plaintext on a Roku device
and then decode it, as demonstrated in the following example:
' store plaintext to be encrypted in an roByteArray
ba = CreateObject("roByteArray")
ba.FromAsciiString("plain text1")
' create roDeviceCrypto object and specify a device key
dc = CreateObject("roDeviceCrypto") encType = "device"
' encrypt plaintext using the device key and store the encoded data in an roByteArray
encrypted = dc.Encrypt(ba, encType)
' decode the encrypted data and store the decrypted data in an roByteArray
if encrypted <> invalid then
decrypted = dc.Decrypt(encrypted,encType)
end ifUpdated 3 months ago
