secKeyEncryptWithBodyAppKey static method
Implementation
static Map<String, dynamic>? secKeyEncryptWithBodyAppKey(Map<String, dynamic> mParams) {
try {
final iv = IV.fromUtf8(UFUtils.encryptionIV);
final key = Key.fromSecureRandom(32).bytes;
final encrypter = Encrypter(AES(Key(key), mode: AESMode.cbc));
final randomString = jsonEncode(mParams);
final encrypted = encrypter.encrypt(randomString, iv: iv);
final result = {
SEK: hex.encode(encrypted.bytes),
HASH: hex.encode(key)
};
return result;
} catch (e) {
return null;
}
}