com.ape9527.core.service.AesService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ape-core Show documentation
Show all versions of ape-core Show documentation
Ape low code platform core module
The newest version!
package com.ape9527.core.service;
import com.ape9527.core.annotation.CustomizedValue;
import com.ape9527.utils.sign.AesUtil;
import org.springframework.stereotype.Service;
/**
* AES加解密服务
*
* @author YuanShuai[[email protected]]
*/
@Service
public class AesService {
/**
* 配置文件中获取16位的密钥
*/
@CustomizedValue("${ape.crypt.secretKey}")
private String secretKey;
/**
* 数据加密
* @param content 待加密数据
* @return 加密后的数据
* @throws Exception
*/
public String encrypt(String content) throws Exception {
return AesUtil.encrypt(content, secretKey);
}
/**
* 数据解密
* @param encrypted 待解密数据
* @return 解密后的数据
* @throws Exception
*/
public String decrypt(String encrypted) throws Exception {
return AesUtil.decrypt(encrypted, secretKey);
}
}