diff --git a/apps/iot/src/iot_cipher_aes.erl b/apps/iot/src/iot_cipher_aes.erl index 005c5a9..4941134 100644 --- a/apps/iot/src/iot_cipher_aes.erl +++ b/apps/iot/src/iot_cipher_aes.erl @@ -22,7 +22,7 @@ test() -> %% 基于aes的加密算法, aes_256_cbc -spec encrypt(binary(), binary()) -> binary(). -encrypt(Key, PlainText) when is_binary(Key), is_binary(PlainText), byte_size(PlainText) >= 32 -> +encrypt(Key, PlainText) when is_binary(Key), is_binary(PlainText) -> IV = binary:part(Key, {0, 16}), crypto:crypto_one_time(aes_256_cbc, Key, IV, PlainText, [{encrypt, true}, {padding, pkcs_padding}]).