Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
常超
map-parent
Commits
19dedad5
Commit
19dedad5
authored
Jul 02, 2022
by
yangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AES接口提交
parent
ababeaed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
common/service_base/src/main/java/com/founder/servicebase/controller/SkAesController.java
+47
-0
No files found.
common/service_base/src/main/java/com/founder/servicebase/controller/SkAesController.java
0 → 100644
View file @
19dedad5
package
com
.
founder
.
servicebase
.
controller
;
import
com.founder.commonutils.model.newPublicEntity.MapRestResult
;
import
com.founder.commonutils.util.AesEncryptUtil
;
import
com.founder.servicebase.logs.OperLog
;
import
com.founder.servicebase.logs.OperationType
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
* 字典控制层
* @author jlt
* @date 2022/03/10/
*/
@RestController
@RequestMapping
(
"Aes"
)
public
class
SkAesController
{
/**
* 新增字典
*/
@GetMapping
(
"query/{data}"
)
@ApiOperation
(
value
=
"AES加密"
)
@OperLog
(
message
=
"AES加密"
,
operation
=
OperationType
.
QUERY
)
public
MapRestResult
save
(
@PathVariable
(
"data"
)
String
data
)
{
//使用AES-128-CBC加密模式
Date
now
=
new
Date
();
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
String
today
=
simpleDateFormat
.
format
(
now
);
String
KEY
=
"maplogin"
+
today
;
String
IV
=
"map_vues"
+
today
;
try
{
data
=
AesEncryptUtil
.
encrypt
(
data
,
KEY
,
IV
);
System
.
out
.
println
(
"数据:"
+
data
);
System
.
out
.
println
(
"加密:"
+
data
);
String
jiemi
=
AesEncryptUtil
.
desEncrypt
(
data
,
KEY
,
IV
).
trim
();
System
.
out
.
println
(
"解密:"
+
jiemi
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
MapRestResult
.
build
(
201
,
"AES-128-CBC加密失败"
,
1
,
e
);
}
return
MapRestResult
.
build
(
200
,
"AES-128-CBC加密模式"
,
1
,
"加密:"
+
data
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment