1 Star 0 Fork 208

鱼煎 / rsa-encrypt-body-spring-boot

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

1.介绍

rsa-encrypt-body-spring-boot
Spring Boot接口加密,可以对返回值、参数值通过注解的方式自动加解密 。

2.使用方法

Apache Maven

<dependency>
  <groupId>cn.shuibo</groupId>
  <artifactId>rsa-encrypt-body-spring-boot</artifactId>
  <version>1.0.0.RELEASE</version>
</dependency>

Gradle Groovy DSL

implementation 'cn.shuibo:rsa-encrypt-body-spring-boot:1.0.0.RELEASE'

Gradle Kotlin DSLScala SBTApache IvyGroovy GrapeLeiningenApache BuildrMaven Central BadgePURLBazel方式请阅读Spring Boot接口RSA自动加解密

  • 以Maven为例,在pom.xml中引入依赖
<dependency>
    <groupId>cn.shuibo</groupId>
    <artifactId>rsa-encrypt-body-spring-boot</artifactId>
    <version>1.0.0.RELEASE</version>
</dependency>
  • 启动类Application中添加@EnableSecurity注解
@SpringBootApplication
@EnableSecurity
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}
  • 在application.yml或者application.properties中添加RSA公钥及私钥
rsa:
  encrypt:
    debug: false # true表示开启调试,不加密。(方便开发时测试)
    publicKey: 123456
    privateKey: 123456
  • 对返回值进行加密
@Encrypt
@GetMapping("/encryption")
public TestBean encryption(){
    TestBean testBean = new TestBean();
    testBean.setName("shuibo.cn");
    testBean.setAge(18);
    return testBean;
}
  • 对传过来的加密参数解密
@Decrypt
@PostMapping("/decryption")
public String Decryption(@RequestBody TestBean testBean){
    return testBean.toString();
}

3.About author

空文件

简介

Spring Boot 接口请求参数自动加解密 展开 收起
Java
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/7155788/rsa-encrypt-body-spring-boot.git
git@gitee.com:7155788/rsa-encrypt-body-spring-boot.git
7155788
rsa-encrypt-body-spring-boot
rsa-encrypt-body-spring-boot
master

搜索帮助