From c92f96b5251cc8d8494228b0b8deb4eef6fc1d02 Mon Sep 17 00:00:00 2001
From: huangxz <huangxz@xiaopeng.com>
Date: 星期六, 07 三月 2026 21:00:29 +0800
Subject: [PATCH] 【临时!!!】feat: 文件名错误修改
---
/dev/null | 68 ----------------------------------
1 files changed, 0 insertions(+), 68 deletions(-)
diff --git a/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/util/encryptionDecryptionUtil.java b/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/util/encryptionDecryptionUtil.java
deleted file mode 100644
index 9ff43ef..0000000
--- a/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/util/encryptionDecryptionUtil.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.xiaopeng.account.util;
-
-import com.alibaba.fastjson.JSONObject;
-import com.xiaopeng.common.core.utils.AESUtil;
-import com.xiaopeng.common.core.utils.RSAUtil;
-import com.xiaopeng.common.redis.service.RedisService;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * 参数加解密工具类
- */
-@Component
-public class EncryptionDecryptionUtil {
-
- @Resource
- private RedisService redisService;
-
-
- /**
- * 解密
- * @param content
- * @return
- */
- public String decrypt(String content, HttpServletRequest request) {
- //根据用户sessionId获取用户私钥
- String sessionId = request.getSession().getId();
- Object cacheObject = redisService.getCacheObject("session:id:" + sessionId);
- if (null != cacheObject) {
- return content;
- }
- JSONObject jsonObject = JSONObject.parseObject(cacheObject.toString());
- String privateKey = jsonObject.getString("privateKey");
- String xps = request.getHeader("xps");
- //使用用户私钥解密xps获取AES密钥
- String aes_key = RSAUtil.decryptByPrivateKey(xps, privateKey);
- //使用AES密钥解密content
- String decrypt = AESUtil.decryptByCBC(content, aes_key, AESUtil.generateIV());
- //删除用户密钥对,保证秘钥不泄露
- redisService.deleteObject("session:id:" + sessionId);
- return decrypt;
- }
-
-
- /**
- * 加密
- * @param content 待加密内容
- * @param privateKey ARS私钥
- * @return
- */
- public static JSONObject encrypt(String content, String privateKey) {
- //生成 AES 密钥和 IV
- String iv = AESUtil.generateIV();
- //使用用户私钥加密AES密钥
- String aes_key = AESUtil.generateKey(AESUtil.KEY_LENGTH_256);
- //使用AES密钥加密content
- String encrypt = AESUtil.encryptByCBC(content, aes_key, iv);
- //使用用户私钥加密AES密钥
- String encryptAESKey = RSAUtil.encryptByPrivateKey(aes_key, privateKey);
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("iv", iv);
- jsonObject.put("aes_key", encryptAESKey);
- jsonObject.put("content", encrypt);
- return jsonObject;
- }
-}
--
Gitblit v1.7.1