阿里短信配置加密存储

This commit is contained in:
周源 2022-09-27 10:19:54 +08:00
parent f602b39b64
commit 8cfadfac79
1 changed files with 10 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.ydool.boot.common.cache.ConfigUtils;
import com.ydool.boot.common.utils.CodecUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@ -27,8 +28,8 @@ public class SmsUtil {
public static void sendMsg(String phone, String code) {
try {
// *配在后台的参数设置里
String accessKeyId = ConfigUtils.getStr("accessKey");
String accessKeySecret = ConfigUtils.getStr("secretKey");
String accessKeyId = CodecUtils.decrypt(ConfigUtils.getStr("accessKey"));
String accessKeySecret = CodecUtils.decrypt(ConfigUtils.getStr("secretKey"));
//初始化ascClient,暂时不支持多region请勿修改
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId,
@ -60,4 +61,11 @@ public class SmsUtil {
}
}
public static void main(String[] args) {
System.out.println(CodecUtils.encrypt("LTAIlV2ofsSoQe1F"));
System.out.println(CodecUtils.encrypt("SzzGOXLWlH5uMfTzWSjSiXeJRob5Hn"));
//FTTBgNtCg9GBGT+s9rHxW3HzpejcEigRrTLajmT66UI=
//+Iaa48Ms++B5e4eJl5bH7nU8jb0Ban3FDob7lit1TTc=
}
}