Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-account
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.account
pica-cloud-account
提交
b5250d34
提交
b5250d34
编写于
11月 06, 2019
作者:
rushui.chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
20191106 解密逻辑处理
上级
c233c3d4
流水线
#16658
已失败 于阶段
in 0 second
变更
4
流水线
1
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
38 行增加
和
52 行删除
+38
-52
Test.java
...main/java/com/pica/cloud/account/account/server/Test.java
+3
-15
CipherController.java
...d/account/account/server/controller/CipherController.java
+16
-0
AESUtil.java
...a/com/pica/cloud/account/account/server/util/AESUtil.java
+18
-36
bootstrap.properties
server/src/main/resources/bootstrap.properties
+1
-1
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/Test.java
浏览文件 @
b5250d34
...
@@ -80,28 +80,16 @@ public class Test {
...
@@ -80,28 +80,16 @@ public class Test {
// System.out.println(encryptEntity1Json);
// System.out.println(encryptEntity1Json);
System
.
out
.
println
(
"--------------------登录接口-------------"
);
System
.
out
.
println
(
"--------------------登录接口-------------"
);
String
publicKey
=
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCa6j3SJwXr/pLLwb6Pq8pi9StPq+Wvm6vu+LWQB1hNqClWk0jQm5GnF6Kj0ac2gqgsMsutc3hhMaaX2QZvLX+gFQHC/ufGBdBbpPtDeGWsQItsMf/xqqlkLPkc7eVTyfsmrpQM7BG9LVvaPVXPVUcZfJNBaYuR4+Sf6Zi2ayI/hQIDAQAB"
;
BaseRequest
login
=
new
BaseRequest
();
BaseRequest
login
=
new
BaseRequest
();
login
.
setMobile
(
"13024112588"
);
login
.
setMobile
(
"13024112588"
);
login
.
setPassword
(
"d0dcbf0d12a6b1e7fbfa2ce5848f3eff"
);
login
.
setPassword
(
"d0dcbf0d12a6b1e7fbfa2ce5848f3eff"
);
//qq123456
String
con
=
JSONObject
.
toJSONString
(
login
);
String
con
=
JSONObject
.
toJSONString
(
login
);
String
contentResult
=
AESUtil
.
aesEncrypt
(
con
,
"YCPQPx4qpQjEjDea"
);
//十六位随机数
String
publicKey
=
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCa6j3SJwXr/pLLwb6Pq8pi9StPq+Wvm6vu+LWQB1hNqClWk0jQm5GnF6Kj0ac2gqgsMsutc3hhMaaX2QZvLX+gFQHC/ufGBdBbpPtDeGWsQItsMf/xqqlkLPkc7eVTyfsmrpQM7BG9LVvaPVXPVUcZfJNBaYuR4+Sf6Zi2ayI/hQIDAQAB"
;
String
contentResult
=
AESUtil
.
aesEncrypt
(
con
,
"YCPQPx4qpQjEjDea"
);
String
keyResult
=
RSAUtil
.
encrypt
(
"YCPQPx4qpQjEjDea"
,
publicKey
);
String
keyResult
=
RSAUtil
.
encrypt
(
"YCPQPx4qpQjEjDea"
,
publicKey
);
EncryptEntity
encryptTest
=
new
EncryptEntity
();
EncryptEntity
encryptTest
=
new
EncryptEntity
();
encryptTest
.
setContent
(
contentResult
);
encryptTest
.
setContent
(
contentResult
);
encryptTest
.
setKey
(
keyResult
);
encryptTest
.
setKey
(
keyResult
);
...
...
server/src/main/java/com/pica/cloud/account/account/server/controller/CipherController.java
浏览文件 @
b5250d34
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
controller
;
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
controller
;
import
com.pica.cloud.account.account.server.util.AESUtil
;
import
com.pica.cloud.account.account.server.util.RSAUtil
;
import
com.pica.cloud.account.account.server.util.RSAUtil
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -7,6 +8,8 @@ import io.swagger.annotations.ApiOperation;
...
@@ -7,6 +8,8 @@ import io.swagger.annotations.ApiOperation;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
/**
/**
...
@@ -27,4 +30,17 @@ public class CipherController {
...
@@ -27,4 +30,17 @@ public class CipherController {
return
PicaResponse
.
toResponse
(
rsaPublicKey
);
return
PicaResponse
.
toResponse
(
rsaPublicKey
);
}
}
/**
* todo:上线前需要注释掉
* @param key
* @return
* @throws Exception
*/
@ApiOperation
(
"解密操作"
)
@GetMapping
(
value
=
"/cipher/decrypt"
)
public
PicaResponse
<
String
>
decryptPublicKey
(
@RequestParam
String
key
)
throws
Exception
{
return
PicaResponse
.
toResponse
(
RSAUtil
.
decrypt
(
key
,
AESUtil
.
privateKey
));
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/util/AESUtil.java
浏览文件 @
b5250d34
...
@@ -166,45 +166,27 @@ public class AESUtil {
...
@@ -166,45 +166,27 @@ public class AESUtil {
* 测试
* 测试
*/
*/
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
KEY
=
"zJJ$c5md3$yuuhWW"
;
// String KEY="zJJ$c5md3$yuuhWW";
System
.
out
.
println
(
"-------------加密---------"
);
// System.out.println("-------------加密---------");
String
content
=
"13024112666"
;
// String content = "13024112588";
System
.
out
.
println
(
"加密前:"
+
content
);
// System.out.println("加密前:" + content);
System
.
out
.
println
(
"加密密钥和解密密钥:"
+
KEY
);
// System.out.println("加密密钥和解密密钥:" + KEY);
//
System
.
out
.
println
(
"-------------解密---------"
);
// System.out.println(
String
encrypt
=
aesEncrypt
(
content
,
KEY
);
// "-------------解密---------");
System
.
out
.
println
(
"加密后:"
+
encrypt
);
// String encrypt = aesEncrypt(content, KEY);
String
decrypt
=
aesDecrypt
(
encrypt
,
KEY
);
// System.out.println("加密后:" + encrypt);
System
.
out
.
println
(
"解密后:"
+
decrypt
);
// String decrypt = aesDecrypt(encrypt, KEY);
// System.out.println("解密后:" + decrypt);
//请求参数解密处理
//请求参数解密处理
// String encrypt="DC7Sc7ydClKJztuIz/E/5fXuQ8hqdr4W8mxL/XACtqT2wzK3jBiRXnoPOvR9lANIinXInrdbY5rCIwTiI9DeWFiwPP7cSF0cjnQOY11oJLjVg9qV9VZQXbFyDYVhRv8bbto5hD4evryzbdPTq6A23fD5LmXFYnWKdbSzZfFUl/w
=";
String
key
=
"HW3jIbG2YmNLzciarYVrUPifLbKPnkxTItwXkFaYD+tUCS3i2GVHoPDKCgv6OTVvy84Ga36kD1Q/B57+/aHutGV8KL8NZp5LQC6qlXxC4c7oG1Inb8zYPPcHLqpChxAqxPEl1ivbepbQA5x6zJCNtXUCcVKmVhiqAqH68l3GoVQ
="
;
// String decrypt = RSAUtil.decrypt(encrypt
,privateKey);
String
decrypt
=
RSAUtil
.
decrypt
(
key
,
privateKey
);
//
System.out.println(decrypt);
System
.
out
.
println
(
decrypt
);
//
//System.out.println("YCPQPx4qpQjEjDea");
//System.out.println("YCPQPx4qpQjEjDea");
// String content="
z9zZyUYwKkYy08l0s1qH9CSnoNnXZbbhHVbAUwGIsOXKPGeTkZFnbL1HYJQXBdKqGzKZt8E5lDzdTGUiUVkkK8GO27fsSrRMewY5T6ndSuo
=";
// String content="
Rmlca6BiqwNi0NA+BWUsn6NU/0bCvXCMxNv166jvZDbjJxZyZVhOzGTsWsqYvqDbHDO/0lfihG1I5BXQbFyOEVvFl72tVVaxROolLtzYkO7pX1GgAYfqofEDmQuZmX18JdfOi1DWrWoO0+HQHD3lRw=
=";
// String result = AESUtil.aesDecrypt(content, decrypt);
// String result = AESUtil.aesDecrypt(content, decrypt);
// System.out.println(result);
// System.out.println(result);
}
}
}
}
server/src/main/resources/bootstrap.properties
浏览文件 @
b5250d34
spring.profiles.active
=
uat
spring.profiles.active
=
dev
\ No newline at end of file
\ No newline at end of file
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录