类 MbedAkeySe
- java.lang.Object
-
- com.baidubce.services.iothisk.device.seplatform.MbedAkeySe
-
- 所有已实现的接口:
SecureElement
public class MbedAkeySe extends Object implements SecureElement
Mbed akey secure element. It provides mbed_akey type secure element.
-
-
构造器概要
构造器 构造器 说明 MbedAkeySe(Device device, DeviceKey deviceKey)Construct a mbed akey secure element using the specified device and device key
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidcheckActiveMessage(ActiveMessage activeMessage)Valid active message with secure element.byte[]decrypt(byte[] encryption)Decrypt encrypted messageCipherMessageencryptThenSign(PlainMessage plainMessage)Encrypt and sign provided plain messageCipherMessageencryptThenSign(PlainMessage plainMessage, byte[] signPrivateKey)Encrypt plain message, and sign the signature with provided private keyStringgenerateId()Generate device unique idActiveMessageparseActiveMessage(byte[] activeMessage)Parse byte array active messageCipherMessageparseCipherMessage(byte[] cipherMessage)Parse byte array cipher message.PlainMessageparsePlainMessage(byte[] plainMessage)Parse byte array plain message.voidverifySignature(byte[] message, byte[] signature)Verify message signature.PlainMessageverifyThenDecrypt(CipherMessage cipherMessage)Verify message and decrypt cipher message.
-
-
-
方法详细资料
-
generateId
public String generateId()
Generate device unique id- 指定者:
generateId在接口中SecureElement- 返回:
- device unique id in ascii encoding
-
encryptThenSign
public CipherMessage encryptThenSign(PlainMessage plainMessage)
Encrypt and sign provided plain message- 指定者:
encryptThenSign在接口中SecureElement- 参数:
plainMessage- specified plain message- 返回:
- cipher message, including encrypted message and its signature
-
encryptThenSign
public CipherMessage encryptThenSign(PlainMessage plainMessage, byte[] signPrivateKey)
Encrypt plain message, and sign the signature with provided private key- 指定者:
encryptThenSign在接口中SecureElement- 参数:
plainMessage- specified plain messagesignPrivateKey- specified signature private key- 返回:
- cipher message, including encrypted message and its signature
-
decrypt
public byte[] decrypt(byte[] encryption)
Decrypt encrypted message- 指定者:
decrypt在接口中SecureElement- 参数:
encryption- specified encrypted message in byte array- 返回:
- plain message in byte array
-
verifySignature
public void verifySignature(byte[] message, byte[] signature)Verify message signature. If failed, an exception will be thrown.- 指定者:
verifySignature在接口中SecureElement- 参数:
message- specified message in byte arraysignature- specified signature in byte array
-
verifyThenDecrypt
public PlainMessage verifyThenDecrypt(CipherMessage cipherMessage)
Verify message and decrypt cipher message.- 指定者:
verifyThenDecrypt在接口中SecureElement- 参数:
cipherMessage- specified cipher message- 返回:
- plain message decrypted from cipher message, if failed an exception will be thrown.
-
parseCipherMessage
public CipherMessage parseCipherMessage(byte[] cipherMessage)
Parse byte array cipher message.- 指定者:
parseCipherMessage在接口中SecureElement- 参数:
cipherMessage- specified cipher message in byte array- 返回:
- cipher message object
-
parsePlainMessage
public PlainMessage parsePlainMessage(byte[] plainMessage)
Parse byte array plain message.- 指定者:
parsePlainMessage在接口中SecureElement- 参数:
plainMessage- specified plain message- 返回:
- plain message object
-
parseActiveMessage
public ActiveMessage parseActiveMessage(byte[] activeMessage)
Parse byte array active message- 指定者:
parseActiveMessage在接口中SecureElement- 参数:
activeMessage- specified active message- 返回:
- active message object
-
checkActiveMessage
public void checkActiveMessage(ActiveMessage activeMessage)
Valid active message with secure element. If failed, an exception will be thrown.- 指定者:
checkActiveMessage在接口中SecureElement- 参数:
activeMessage- specified active message
-
-