LinkVisual security mechanisms

Updated at:

LinkVisual provides comprehensive end-to-end security. You can enable security features, such as anti-cloning and video encryption, based on your business needs.

Overview

Business scenario

Security mechanism

Security level

Usage method

Device identity authentication

One device, one secret

High

Configure in the cloud console

One product, one secret

Medium

Configure in the cloud console

Preventing product mix-ups

High

Requires minor development on the device

App identity authentication

Secure logon

High

Supported by default on Android, iOS, and PC

API security

High

Identity and permission control supported by default. HTTPS is optional.

Video playback

Playback data encryption

High

Encryption is optional for player version 1.x and mandatory for player version 2.x.

Device stream ingest data encryption

High

Requires minor development on the device

Security mechanism details

Device identity authentication

A device must pass identity authentication before it connects to the IoT Living Platform. For a comparison of the authentication methods that the platform supports and the related threat descriptions, see the Mass Production Devices document.

For devices that use the one-device-one-secret method, the platform provides an anti-cloning solution to prevent a device certificate (the trituple: ProductKey, DeviceName, and DeviceSecret) from being repeatedly flashed onto multiple devices. This requires minor development on the device. The following table shows the behavior of repeated flashing for different app sharing methods:

Sharing method

Device does not support anti-cloning

Device supports anti-cloning

Preemptive

After User A attaches Device A, User B can still attach the device successfully, and User A is automatically detached. When Device A comes online, User B can view the video from Device A.

Device B cannot come online. User B cannot attach Device B. User A can use Device A normally.

Authorization-based

After User A attaches Device A, User B cannot attach the device. However, if Device B successfully connects to the network, it can still come online. User A can view the video from Device B.

Device B cannot come online. User B cannot attach Device B. User A can use Device A normally.

Shared

User A attaches Device A and becomes the administrator. User B attaches Device B and becomes a sub-member. When both Device A and Device B are online, User A and User B can randomly see the video from either Device A or Device B.

Device B cannot come online. User B cannot attach Device B. User A can use Device A normally.

Account mixing prevention mechanism

When the anti-cloning feature is enabled, a device uses a unique UUID to connect to the cloud and come online. After the device comes online successfully, its device certificate is attached to this unique UUID. If another device with a different UUID tries to come online using the same device certificate, the cloud will prevent it from coming online. This prevents data breaches.

Recommended ways to select a UUID:

  1. Select one of the following as the device UUID: an IMEI, a MAC address, or a CPU serial number. If you use this type of device information, ensure that the retrieved value is always the same. If the value cannot be read successfully, the device may fail to come online.

  2. For devices with persistent storage, create a UUID during the first startup and store it permanently on the storage device.

Device-side development method

Implement the `HAL_GetUUID` function of the IoT software development kit (SDK). Comments are provided in the files at the following paths:

ali-smartliving-device-sdk-c/include/imports/iot_import_product.h
ali-smartliving-device-sdk-c/src/ref-impl/hal/os/ubuntu/HAL_OS_linux.c

Note that each device must have a unique UUID. The UUID obtained through `HAL_GetUUID` must remain consistent in all scenarios.

Note

The anti-cloning feature is enabled by default in SDK versions 2.4.5 and later. If you assess the security risk of device cloning and still want to disable this feature, return -1 in the `HAL_GetUUID` method:

int HAL_GetUUID(uint8_t *buf, int len) {
    return -1;
}

Handling disabled devices

  • If a device is disabled, the user can contact after-sales support to replace the device certificate. (A device with the same UUID but a different device certificate can still come online.)

  • If you change the UUID but want to continue using the original device certificate, contact technical support.

App identity authentication

The platform provides a stable and secure logon component that uses the HTTPS protocol and multiple layers of protection to secure user accounts and privacy. For the Android, iOS, and PC components, you must add extra encryption protection for the AppSecret key:

Use the encryption interface provided by the AppKeyEncode library to encrypt the AppSecret. Do not store the AppSecret in plaintext.

App users must log on before they can use features such as device control and video playback through the platform's open APIs. The platform uses HTTPS to encrypt API requests. Ensure that you have not disabled this feature:

In the network request provided by the APIClient SDK, set the scheme of the request to HTTPS, not HTTP.

  • Android:

    IoTRequest request = new IoTRequestBuilder().setScheme(Scheme.HTTPS).build();
    
  • iOS:

    IMSIoTRequestBuilder *builder = [[IMSIoTRequestBuilder alloc] initWithPath:path
                                                                        apiVersion:version
                                                                            params:params];
    [builder setAuthenticationType:IMSAuthenticationTypeIoT];
    [builder setScheme:@"https://"];
    IMSRequest *request = [builder build];

Video playback

LinkVisual provides an end-to-end encryption mechanism for video playback. This mechanism effectively prevents unauthorized access to video footage, even if data packets are intercepted during network transmission. Encrypt video playback and device stream ingest as described below. Otherwise, you risk a user privacy breach.

Playback client

Use the secure encrypted player provided by LinkVisual. It automatically decrypts video data for secure playback. We recommend that you upgrade to the latest 2.x version. If you are still using a 1.x version, enable encryption by default. To enable encryption:

  • Android:

     /**
     * Sets the data source for IPC live streaming.
     *
     * @param iotId             The iotId of the device.
     * @param streamType        The stream type. If there are multiple streams, note this parameter. C.STREAM_TYPE_MAJOR indicates the major stream. C.STREAM_TYPE_MINOR indicates the minor stream.
     * @param relayEncrypted    Specifies whether to encrypt the stream on the cloud. We recommend that you enable this.
     * @param relayEncryptType  The encryption type for the cloud stream.
     * @param forceIFrame       Specifies whether to force an I-frame. We recommend that you enable this.
     * @param cacheDurationInMs The duration of the video to cache on the cloud, in ms. If data exists, playback is accelerated. We recommend that this value does not exceed one GOP.
     */
    void setIPCLiveDataSource(String iotId, int streamType, boolean relayEncrypted, int relayEncryptType, boolean forceIFrame, int cacheDurationInMs)
    
  • iOS:

    // Set the parameter rtmpPath, which is the RTMP address.
    // needEncrypt: true indicates that encryption is required.
    [player setDataSource_Live:rtmpPath
                   needEncrypt:needEncrypt
                            iv:iv
                           key:key];

Device side

  • For versions 2.4.5 and earlier, configure encryption as follows:

    When the device starts, report the value of the `EncryptSwitch` property in the Thing Specification Language (TSL) model as 1. The following code provides an example:

    unsigned char *encrypt_switch = "{\"EncryptSwitch\":1}";
    IOT_Linkkit_Report(0, ITM_MSG_POST_PROPERTY, encrypt_switch, strlen(value));
  • For versions 2.5.0 and later, the device SDK encrypts video stream ingest data by default. If you assess the risk of a data breach from device video stream ingest and still want to disable encryption, use the following setting to disable it:

    lv_init_config_s config;
    config.stream_auto_encrypt_disable = 1;
    lv_init(&config, &callback, &system);