{"id":15292555,"url":"https://github.com/xiaohaoo/encrypt-env-spring-boot-starter","last_synced_at":"2026-04-16T03:31:18.006Z","repository":{"id":57729794,"uuid":"449301316","full_name":"xiaohaoo/encrypt-env-spring-boot-starter","owner":"xiaohaoo","description":"  spring boot中对配置信息进行脱敏处理","archived":false,"fork":false,"pushed_at":"2022-04-27T07:58:43.000Z","size":92,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T10:21:17.325Z","etag":null,"topics":["gradle","java","spring-boot","spring-boot-starter","spring-framework"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xiaohaoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-18T13:45:27.000Z","updated_at":"2022-04-27T08:01:44.000Z","dependencies_parsed_at":"2022-09-10T22:22:58.367Z","dependency_job_id":null,"html_url":"https://github.com/xiaohaoo/encrypt-env-spring-boot-starter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xiaohaoo/encrypt-env-spring-boot-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaohaoo%2Fencrypt-env-spring-boot-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaohaoo%2Fencrypt-env-spring-boot-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaohaoo%2Fencrypt-env-spring-boot-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaohaoo%2Fencrypt-env-spring-boot-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiaohaoo","download_url":"https://codeload.github.com/xiaohaoo/encrypt-env-spring-boot-starter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaohaoo%2Fencrypt-env-spring-boot-starter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gradle","java","spring-boot","spring-boot-starter","spring-framework"],"created_at":"2024-09-30T16:18:45.682Z","updated_at":"2026-04-16T03:31:17.940Z","avatar_url":"https://github.com/xiaohaoo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# encrypt-env-spring-boot-starter\n\n# 使用场景\n\n在Spring Boot中，配置参数使用明文的方式造成敏感信息泄露，例如：\n\n```yml\nspring:\n  datasource:\n    username: admin\n    password: admin\n    url: jdbc:mysql://127.0.0.1:3306\n```\n\n现在，可以使用encrypt-env-spring-boot-starter可以对配置信息进行脱敏处理，避免了因为不安全的因素将敏感数据泄露。遵循spring-boot-starter的通用starter配置方式，开箱即用。\n\n```yml\nspring:\n  datasource:\n    username: enc:twGrVRJ60ACdcY0JFP/gbQ==\n    # or username: \"{enc:twGrVRJ60ACdcY0JFP/gbQ==}\"\n    password: enc:KsaeJD9ahUNJtR8yR8koJw==\n    # or password: \"{enc:KsaeJD9ahUNJtR8yR8koJw==}\"\n    url: enc:fas0AsdsfafJFP/adaewff\n    # or url: \"abc{enc:fas0AsdsfafJFP/adaewff}cba\"\n```\n\n# 使用方式\n\n1. 引入\n\n```groovy\nimplementation 'com.xiaohaoo:encrypt-env-spring-boot-starter:1.1.0'\n```\n\n```xml\n\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.xiaohaoo\u003c/groupId\u003e\n    \u003cartifactId\u003eencrypt-env-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n2. 配置\n\n对配置文件中的敏感数据进行加密后添加前缀 **enc:** 或者使用 **{enc:密文}** 即可。\n\n```yml\nspring:\n  datasource:\n    username: enc:twGrVRJ60ACdcY0JFP/gbQ==\n    # or username: \"{enc:twGrVRJ60ACdcY0JFP/gbQ==}\"\n    password: enc:KsaeJD9ahUNJtR8yR8koJw==\n    # or password: \"{enc:KsaeJD9ahUNJtR8yR8koJw==}\"\n    url: enc:fas0AsdsfafJFP/adaewff\n    # or url: \"abc{enc:fas0AsdsfafJFP/adaewff}cba\"\n```\n\n3. 获取加密字符串\n\n```java\npublic class EncryptEnvApplicationTests {\n\n    @Test\n    void encrypt() {\n        // 对称加密秘钥\n        SecretHandler aesSecretResolve = new AesSecretHandler(\"xiaohaoo\");\n        // 要加密的字符串\n        System.out.println(aesSecretResolve.encrypt(\"spring boot\"));\n    }\n}\n```\n\n# 加密方法\n\n计划支持：\n\n- [x] AES\n- [ ] DES\n- [ ] RSA","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaohaoo%2Fencrypt-env-spring-boot-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiaohaoo%2Fencrypt-env-spring-boot-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaohaoo%2Fencrypt-env-spring-boot-starter/lists"}