当前位置: 首页 > news >正文

【藏经阁】加密机服务完整解决方案,包含客户端+服务端

前言

你是否存在这样的苦恼,数据需要安全存储,但是每个系统大家自己写,很浪费时间。

encryption-local 一个离线版本的金融敏感信息加解密工具,用于数据库敏感信息存储。

离线版本的加解密好处是非常的方便。不过缺点也比较明显,那就是在真正追求安全的公司,研发是不能够拥有直接加解密的能力的。

所以最好是有一个单独的加密机服务,对公司内部提供统一的加解密能力。

项目推荐

下面是一些日志、加解密、脱敏安全相关的库推荐:

项目介绍
sensitive-word高性能敏感词核心库
sensitive-word-admin敏感词控台,前后端分离
sensitive高性能日志脱敏组件
auto-log统一日志切面组件,支持全链路traceId
encryption-local离线加密机组件
encryption加密机标准API+本地客户端
encryption-server加密机服务

拓展阅读

【老马】离线版金融敏感信息加解密组件开源项目encryption-local

【藏经阁】加密机服务完整解决方案,包含客户端+服务端

项目简介

encryption 加密机接口定义+本地客户端。

和 encryption-server 加密机服务端配套使用。

特性

  • 加密机标准的 API 定义

  • 加密机 http 客户端

  • 支持 姓名/手机号/银行卡/身份证/邮箱/地址/密码 等常见的的加解密策略

  • 支持通用加密策略

快速开始

核心方法

加密方法

方法说明备注
encryptName姓名加密
encryptPassword密码加密
encryptAddress地址加密
encryptBankCardNum银行卡号加密
encryptEmail邮箱加密
encryptIdCard身份证加密
encryptPhone手机号加密
encryptCommon通用加密

解密方法

方法说明备注
decryptName姓名解密
decryptPassword密码解密
decryptAddress地址解密
decryptBankCardNum银行卡号解密
decryptEmail邮箱解密
decryptIdCard身份证解密
decryptPhone手机号解密
decryptCommon通用解密

基本方法例子

初始化客户端

EncryptionClient encryptionClient = EncryptionClientBs.newInstance().systemId("client-test").encryptionClient();return encryptionClient;

姓名

EncryptionClient encryptionClient = getEncryptionClient();final String plainText = "张三丰";
EncryptNameResponse encryptNameResponse = encryptionClient.encryptName(plainText);
Assert.assertEquals("张*丰", encryptNameResponse.getNameMask());// 解密
String cipher = encryptNameResponse.getNameCipher();
DecryptNameResponse decryptNameResponse = encryptionClient.decryptName(cipher);
Assert.assertEquals(plainText, decryptNameResponse.getName());

手机号

EncryptionClient encryptionClient = getEncryptionClient();final String plainText = "13012345678";
EncryptPhoneResponse encryptPhoneResponse = encryptionClient.encryptPhone(plainText);
Assert.assertEquals("130****5678", encryptPhoneResponse.getPhoneMask());// 解密
String cipher = encryptPhoneResponse.getPhoneCipher();
DecryptPhoneResponse decryptPhoneResponse = encryptionClient.decryptPhone(cipher);
Assert.assertEquals(plainText, decryptPhoneResponse.getPhone());

邮箱

EncryptionClient encryptionClient = getEncryptionClient();final String plainText = "13012345678@lm.com";
EncryptEmailResponse encryptEmailResponse = encryptionClient.encryptEmail(plainText);
Assert.assertEquals("130********@lm.com", encryptEmailResponse.getEmailMask());// 解密
String cipher = encryptEmailResponse.getEmailCipher();
DecryptEmailResponse decryptEmailResponse = encryptionClient.decryptEmail(cipher);
Assert.assertEquals(plainText, decryptEmailResponse.getEmail());

身份证

EncryptionClient encryptionClient = getEncryptionClient();final String plainText = "330781198509072752";
EncryptIdCardResponse encryptIdCardResponse = encryptionClient.encryptIdCard(plainText);
Assert.assertEquals("330781*********752", encryptIdCardResponse.getIdCardMask());// 解密
String cipher = encryptIdCardResponse.getIdCardCipher();
DecryptIdCardResponse decryptIdCardResponse = encryptionClient.decryptIdCard(cipher);
Assert.assertEquals(plainText, decryptIdCardResponse.getIdCard());

银行卡号

EncryptionClient encryptionClient = getEncryptionClient();final String plainText = "9996666888866668888";
EncryptBankCardNumResponse encryptBankCardNumResponse = encryptionClient.encryptBankCardNum(plainText);
Assert.assertEquals("999666*********8888", encryptBankCardNumResponse.getBankCardNumMask());// 解密
String cipher = encryptBankCardNumResponse.getBankCardNumCipher();
DecryptBankCardNumResponse decryptBankCardNumResponse = encryptionClient.decryptBankCardNum(cipher);
Assert.assertEquals(plainText, decryptBankCardNumResponse.getBankCardNum());

密码

EncryptionClient encryptionClient = getEncryptionClient();final String plainText = "123456";
EncryptPasswordResponse response = encryptionClient.encryptPassword(plainText);
Assert.assertEquals("EncryptPasswordResponse{passwordCipher='D80D4580CA9A6E4EF2CA13EF9975348A', passwordMask='******', passwordHash='E10ADC3949BA59ABBE56E057F20F883E'}", response.toString());// 解密
String cipher = response.getPasswordCipher();
DecryptPasswordResponse decryptResponse = encryptionClient.decryptPassword(cipher);
Assert.assertEquals(plainText, decryptResponse.getPassword());

地址

EncryptionClient encryptionClient = getEncryptionClient();final String plainText = "地球村中国上海外滩88号";
EncryptAddressResponse response = encryptionClient.encryptAddress(plainText);
Assert.assertEquals("EncryptAddressResponse{addressCipher='5883ED53C3552103DCED5702F04A2919C901D3BD77E8F69B3EF71EC0B3A53D479251FF49F0271C38E902DF828D233010', addressMask='地球村中国上**滩88号', addressHash='FE33D5C0BCE5EA5FE6E7B300F5421218'}", response.toString());// 解密
String cipher = response.getAddressCipher();
DecryptAddressResponse decryptResponse = encryptionClient.decryptAddress(cipher);
Assert.assertEquals(plainText, decryptResponse.getAddress());

通用

EncryptionClient encryptionClient = getEncryptionClient();final String plainText = "地球村中国上海外滩88号";
CommonEncryptResponse response = encryptionClient.encryptCommon(plainText, EncryptEnum.ADDRESS);
Assert.assertEquals("CommonEncryptResponse{cipher='5883ED53C3552103DCED5702F04A2919C901D3BD77E8F69B3EF71EC0B3A53D479251FF49F0271C38E902DF828D233010', mask='地球村中国上**滩88号', hash='FE33D5C0BCE5EA5FE6E7B300F5421218'}", response.toString());// 解密
String cipher = response.getCipher();
CommonDecryptResponse decryptResponse = encryptionClient.decryptCommon(cipher, EncryptEnum.ADDRESS);
Assert.assertEquals(plainText, decryptResponse.getPlainText());

服务端

encryption-server 加密机服务+和encryption 加密机本地客户端配套使用。

创作目的

实现一款开箱即用的加密机服务。

特性

  • 身份证加解密

  • 地址加解密

  • 姓名加解密

  • 邮箱加解密

  • 手机号加解密

  • 银行卡加解密

  • 密码加解密

快速开始

执行脚本

执行 mysql-5.7.sql

Datasource 类中修改对应的 mysql 账密和链接信息

maven 引入

mvn clean install

运行

直接运行 BootApplication#main() 方法

源码获取

阅读原文即可获取全部源码。

【藏经阁】加密机服务完整解决方案,包含客户端+服务端

小结

安全是每一家公司不可忽略的部分,再加上合规监管的要求,一定要重视用户的数据安全和隐私。

希望这个项目可以帮助到你。

我是老马,期待与你的下次重逢~

相关文章:

  • AI:OpenAI论坛分享—《AI重塑未来:技术、经济与战略》
  • 【方法论】如何构建金字塔框架
  • 实操分享java应用容器化,使用docker作为容器工具
  • Cursor:简单三步提高生成效率
  • 想要建站但没有服务器?雨云RCA,免服务器即可搭建完整网站!!!
  • 目标检测新突破:用MSBlock打造更强YOLOv8
  • 基于 STM32 的全自动洗车监控系统设计与实现
  • 我的电赛(简易的波形发生器大一暑假回顾)
  • 学习黑客HTTP 请求头
  • MyBatis-Plus 的 updateById 方法不更新 null 值属性的问题
  • 第三十六节:特征检测与描述-特征匹配
  • 2025年PMP 学习二十 第13章 项目相关方管理
  • 【QGIS二次开发】地图编辑-06
  • python3GUI--智慧交通分析平台:By:PyQt5+YOLOv8(详细介绍)
  • 算法篇----二分查找
  • O2O电商变现:线上线下相互导流——基于定制开发开源AI智能名片S2B2C商城小程序的研究
  • #Redis黑马点评#(六)Redis当中的消息队列
  • k8s备份namespace
  • 多模态信息提取:打通数据价值的“最后一公里”
  • TDengine 在新能源领域的价值
  • 吴双评《发展法学》|穷国致富的钥匙:制度,还是产业活动?
  • 内蒙古赤峰市城建集团董事长孙广通拟任旗县区党委书记
  • 发射后失联,印度地球观测卫星发射任务宣告失败
  • 家国万里·时光故事会|构筑中国船舰钢筋铁骨,她在焊花里展现工匠风范
  • 哪条线路客流最大?哪个站点早高峰人最多?上海地铁一季度客流报告出炉
  • 首映|《星际宝贝史迪奇》真人电影,不变的“欧哈纳”