类 IotHiskDevice


  • public class IotHiskDevice
    extends Object
    Provides the hisk device with the local secure element ability. Currently, only baidu mbed_akey secure element is supported.
    • 构造器详细资料

      • IotHiskDevice

        public IotHiskDevice​(Device device)
        Constructs a new hisk device client using the provided hisk device info.
        参数:
        device - specified hisk basic device info, corresponding to the contract created in hisk cloud service.
    • 方法详细资料

      • getDeviceId

        public String getDeviceId()
        Get unique device id in ascii encoding
        返回:
        unique device id
      • getActiveData

        public byte[] getActiveData()
        Get device active data generated by device secure element
        返回:
        successful device active data in byte array, otherwise an exception will be thrown
      • encrypt

        public byte[] encrypt​(byte[] message)
        Encrypt message with device secure element.
        参数:
        message - plain message in byte array
        返回:
        successful cipher message in byte array, otherwise an exception will be thrown
      • decrypt

        public byte[] decrypt​(byte[] cipherMessage)
        Decrypt cipher with device secure element.
        参数:
        cipherMessage - cipher message in byte array
        返回:
        successful plain message in byte array, otherwise an exception will be thrown
      • getCurrentCounter

        public long getCurrentCounter()
        Get device client current counter. Counter will be used to check message to resist replay attack.
        返回:
        current device counter.
      • setCurrentCounter

        public void setCurrentCounter​(long counter)
        Set device counter by user specified counter.
        参数:
        counter - specified counter