类 AesEncrypt
- java.lang.Object
-
- com.baidubce.services.iothisk.device.crypto.AesEncrypt
-
public class AesEncrypt extends Object
Provides AES crypto functions
-
-
构造器概要
构造器 构造器 说明 AesEncrypt()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static byte[]decrypt(byte[] data, SecretKey key, IvParameterSpec iv, String cipherName)Decrypt message with specified secret key, cipher name, init vector and cipher name.static byte[]decryptByCTRNoPadding(byte[] data, byte[] key, byte[] iv)Decrypt message with AES/CTR/NoPadding cipherstatic byte[]encrypt(byte[] data, SecretKey key, String cipherName)Encrypt message with specified secret key and cipher name.static byte[]encrypt(byte[] data, SecretKey key, IvParameterSpec iv, String cipherName)Encrypt message with specified secret key, cipher name, init vector and cipher name.static byte[]encryptByCTRNoPadding(byte[] data, byte[] key, byte[] iv)Encrypt message with AES/CTR/NoPadding cipherstatic SecretKeyloadKey(byte[] key, String algorithm)Load secret key with provided key data and specified algorithm
-
-
-
方法详细资料
-
loadKey
public static SecretKey loadKey(byte[] key, String algorithm)
Load secret key with provided key data and specified algorithm- 参数:
key- specified key data in btye arrayalgorithm- specified algorithm- 返回:
- secret key
-
encrypt
public static byte[] encrypt(byte[] data, SecretKey key, String cipherName)Encrypt message with specified secret key and cipher name.- 参数:
data- specified message data in byte arraykey- specified secret keycipherName- specified cipher name- 返回:
- cipher message in byte array
-
encrypt
public static byte[] encrypt(byte[] data, SecretKey key, IvParameterSpec iv, String cipherName)Encrypt message with specified secret key, cipher name, init vector and cipher name.- 参数:
data- specified message data in byte arraykey- specified secret keyiv- specified init vectorcipherName- specified cipher name- 返回:
- cipher message in byte array
-
decrypt
public static byte[] decrypt(byte[] data, SecretKey key, IvParameterSpec iv, String cipherName)Decrypt message with specified secret key, cipher name, init vector and cipher name.- 参数:
data- specified cipher message data in byte arraykey- specified secret keyiv- specified init vectorcipherName- specified cipher name- 返回:
- plain message in byte array
-
encryptByCTRNoPadding
public static byte[] encryptByCTRNoPadding(byte[] data, byte[] key, byte[] iv)Encrypt message with AES/CTR/NoPadding cipher- 参数:
data- specified message data in byte arraykey- specified key in byte arrayiv- specified init vector- 返回:
- cipher message in byte array
-
decryptByCTRNoPadding
public static byte[] decryptByCTRNoPadding(byte[] data, byte[] key, byte[] iv)Decrypt message with AES/CTR/NoPadding cipher- 参数:
data- specified message data in byte arraykey- specified key in byte arrayiv- specified init vector- 返回:
- plain message in byte array
-
-