11[ 简体中文] ( ./README.md ) | English
2- > This English document is translated by Google Translate. If you are willing to assist us with the documentation, please submit the relevant Pull Request.
3- ## Introduction
4- ` encrypt-body-spring-boot-starter ` it is a unified processing method for response body encryption and request body decryption of SpringBoot controller, and supports MD5/SHA/AES/DES/RSA.
5-
6- [ ![ ] ( https://img.shields.io/github/release/Licoy/encrypt-body-spring-boot-starter.svg )] ( )
7- [ ![ ] ( https://img.shields.io/github/issues/Licoy/encrypt-body-spring-boot-starter.svg )] ( )
8- [ ![ ] ( https://img.shields.io/github/issues-pr/Licoy/encrypt-body-spring-boot-starter.svg )] ( )
9- [ ![ ] ( https://img.shields.io/badge/author-Licoy-ff69b4.svg )] ( )
10- ## Encryption and decryption support
11- - There are ways to encrypt:
2+ ## Introduce
3+ ` encrypt-body-spring-boot-starter ` is a unified annotation processing method for response body encoding/encryption and request body decryption for ` springboot ` controller, and supports MD5/SHA/AES/DES/RSA.
4+
5+ [ ![ ] ( https://img.shields.io/github/release/Licoy/encrypt-body-spring-boot-starter.svg )] ( )
6+ [ ![ ] ( https://img.shields.io/github/issues/Licoy/encrypt-body-spring-boot-starter.svg )] ( )
7+ [ ![ ] ( https://img.shields.io/github/issues-pr/Licoy/encrypt-body-spring-boot-starter.svg )] ( )
8+ [ ![ ] ( https://img.shields.io/badge/author-Licoy-ff69b4.svg )] ( )
9+ ## Support
10+ - The ways in which encoding/encryption can be performed are:
1211 - - [x] MD5
13- - - [x] SHA-1 / SHA-256
12+ - - [x] SHA-1/ SHA-256
1413 - - [x] AES
1514 - - [x] DES
1615 - - [x] RSA
17- - There are ways to decrypt:
16+ - The methods that can be decrypted are:
1817 - - [x] AES
1918 - - [x] DES
2019 - - [x] RSA
21- ## Usage method
22- - Introducing dependencies in ` pom.xml ` :
23- ``` xml
20+ ## Import registration
21+ ### Import dependencies
22+ Introduce dependencies in the project's ` pom.xml ` :
23+ ```` xml
2424<dependency >
2525 <groupId >cn.licoy</groupId >
2626 <artifactId >encrypt-body-spring-boot-starter</artifactId >
27- <version >1.1 .0</version >
27+ <version >1.2 .0</version >
2828</dependency >
29- ```
30- - Add the @EnableEncryptBody annotation to the ` Application ` class corresponding to the project, for example:
31- ``` java
29+ ````
30+ ### Enable component
31+ - Add the ` @EnableEncryptBody ` annotation to the ` Application ` class corresponding to the project, such as:
32+ ```` java
3233@EnableEncryptBody
3334@SpringBootApplication
3435public class Application {
@@ -38,49 +39,85 @@ public class Application {
3839 }
3940
4041}
41- ```
42- - Parameter configuration
43- Configure the parameters in the project's ` application.yml ` or ` application.properties ` file, for example:
44- ``` yaml
45- encrypt :
42+ ````
43+ ### Configuration parameters
44+ Add parameter configuration in the ` application.yml ` or ` application.properties ` file of the project , for example:
45+ ```` yaml
46+ encrypt :
4647 body :
4748 aes-key : 12345678 # AES encryption key
4849 des-key : 12345678 # DES encryption key
49- ` ` `
50- - Encrypt the controller response body
51- ` ` ` java
52- @Controller
50+ # more...
51+ ````
52+ ## Use
53+ ### Valid for the entire controller
54+ ```` java
55+ @RestController
56+ @EncryptBody
5357@RequestMapping (" /test" )
5458public class TestController {
5559
5660 @GetMapping
57- @ResponseBody
58- @EncryptBody(value = EncryptBodyMethod.AES)
5961 public String test (){
6062 return " hello world" ;
6163 }
6264
6365}
64- ```
65- Or use ` @RestController ` to encrypt the method response body of the entire controller:
66- ``` java
67- @RestController
68- @EncryptBody
66+ ````
67+ ### Valid for a single request
68+ ```` java
69+ @Controller
6970@RequestMapping (" /test" )
7071public class TestController {
7172
7273 @GetMapping
74+ @ResponseBody
75+ @EncryptBody (value = EncryptBodyMethod . AES )
7376 public String test (){
7477 return " hello world" ;
7578 }
7679
7780}
78- ```
79- ## Annotated list
80- - [ Encrypted annotation list] ( https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/加密注解一览表 )
81- - [ Decryption annotation list] ( https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/解密注解一览表 )
82- ## Discuss
83-
84- - Author blog:[ https://www.licoy.cn ] ( https://www.licoy.cn )
85- ## Open source agreement
86- [ Apache 2.0] ( /LICENSE )
81+ ````
82+ ### Effective on the declared class of the response
83+ ```` java
84+ @Data
85+ @EncryptBody
86+ public class User implements Serializable {
87+
88+ private String name;
89+
90+ private String email;
91+
92+ private Integer number;
93+
94+ private String numberValue;
95+
96+ }
97+ ````
98+ ### Effective for a single attribute of the declared class
99+ ```` java
100+ @Data
101+ @EncryptBody
102+ @FieldBody
103+ public class User implements Serializable {
104+
105+ private String name;
106+
107+ @FieldBody
108+ @AESEncryptBody (key = " 1234567812345678" )
109+ private String email;
110+
111+ @FieldBody (field = " numberValue" , clearValue = true )
112+ @DESEncryptBody (key = " 1234567812345678" )
113+ private Integer number;
114+
115+ private String numberValue;
116+
117+ }
118+ ````
119+ ## Annotation list
120+ - [ Encryption/Encryption Annotation List] ( https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/加密注解一览表 )
121+ - [ Decryption Annotation List] ( https://github.com/Licoy/encrypt-body-spring-boot-starter/wiki/解密注解一览表 )
122+ ## License
123+ [ Apache 2.0] ( /LICENSE )
0 commit comments