类 IotHiskDevice
- java.lang.Object
-
- com.baidubce.services.iothisk.device.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(Device device)Constructs a new hisk device client using the provided hisk device info.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 byte[]decrypt(byte[] cipherMessage)Decrypt cipher with device secure element.byte[]encrypt(byte[] message)Encrypt message with device secure element.byte[]getActiveData()Get device active data generated by device secure elementlonggetCurrentCounter()Get device client current counter.StringgetDeviceId()Get unique device id in ascii encodingvoidsetCurrentCounter(long counter)Set device counter by user specified counter.
-
-
-
构造器详细资料
-
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
-
-