# rsa-encrypt-body-spring-boot **Repository Path**: feiLg/rsa-encrypt-body-spring-boot ## Basic Information - **Project Name**: rsa-encrypt-body-spring-boot - **Description**: Spring Boot 接口请求参数自动加解密 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 229 - **Created**: 2024-02-27 - **Last Updated**: 2024-03-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: 接口加密 ## README ### 1.介绍 **rsa-encrypt-body-spring-boot** Spring Boot接口加密,可以对返回值、参数值通过注解的方式自动加解密完整DEMO案例 。 ### 2.使用方法 **Gradle Kotlin DSL**、**Scala SBT**、**Apache Ivy**、**Groovy Grape**、**Leiningen**、**Apache Buildr**、**Maven Central Badge**、**PURL**、**Bazel**方式请阅读[Spring Boot接口RSA自动加解密](https://www.shuibo.cn/102.html) - **在application.yml或者application.properties中添加RSA公钥及私钥** ``` rsa: encrypt: open: true # 是否开启加密 true or false showLog: true # 是否打印加解密log true or false publicKey: # RSA公钥 privateKey: # RSA私钥 ``` - **对返回值进行加密** ``` @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(); } ```