1 Star 0 Fork 133

WhiteStart / encrypt-body-spring-boot-starter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README_EN.md 2.61 KB
一键复制 编辑 原始数据 按行查看 历史
Licoy 提交于 2018-10-09 17:46 . 更新版本 解决 #1

简体中文 | English

This English document is translated by Google Translate. If you are willing to assist us with the documentation, please submit the relevant Pull Request.

Introduction

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.

Encryption and decryption support

  • There are ways to encrypt:
      • MD5
      • SHA-224 / 256 / 384 / 512
      • AES
      • DES
      • RSA
  • There are ways to decrypt:
      • AES
      • DES
      • RSA

Usage method

  • Introducing dependencies in pom.xml
<dependency>
    <groupId>cn.licoy</groupId>
    <artifactId>encrypt-body-spring-boot-starter</artifactId>
    <version>1.0.2.RELEASE</version>
</dependency>
  • Add the @EnableEncryptBody annotation to the Application class corresponding to the project, for example:
@EnableEncryptBody
@SpringBootApplication
public class Application {
    
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}
  • Parameter configuration Configure the parameters in the project's application.yml or application.properties file, for example:
encrypt:  
    body:
      aes-key: 12345678 #AES encryption key
      des-key: 12345678 #DES encryption key
  • Encrypt the controller response body
@Controller
@RequestMapping("/test")
public class TestController {

    @GetMapping
    @ResponseBody
    @EncryptBody(value = EncryptBodyMethod.AES)
    public String test(){
        return "hello world";
    }

}

Or use @RestController to encrypt the method response body of the entire controller:

@RestController
@EncryptBody
@RequestMapping("/test")
public class TestController {

    @GetMapping
    public String test(){
        return "hello world";
    }

}

Annotated list

Discuss

Open source agreement

Apache 2.0

Java
1
https://gitee.com/hmz123321/encrypt-body-spring-boot-starter.git
git@gitee.com:hmz123321/encrypt-body-spring-boot-starter.git
hmz123321
encrypt-body-spring-boot-starter
encrypt-body-spring-boot-starter
master

搜索帮助