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

网站建设详细流程网络推广专员

网站建设详细流程,网络推广专员,微信公众号运营内容,简单大气的网站模板文章目录什么是脱敏脱敏后带来什么问题解决方案一解决方案二具体实施方案一方案二存量数据处理什么是脱敏 如果你有申请过一些软件资质,应该会被要求敏感数据进行加密,比如密码不能明文,用户的手机号,身份证信息,银行…

文章目录

    • 什么是脱敏
    • 脱敏后带来什么问题
      • 解决方案一
      • 解决方案二
    • 具体实施
      • 方案一
      • 方案二
        • 存量数据处理

什么是脱敏

如果你有申请过一些软件资质,应该会被要求敏感数据进行加密,比如密码不能明文,用户的手机号,身份证信息,银行卡号信息,等等都需要以加密的形式放在数据库中,防止因系统漏洞导致被拖库,黑客直接就能拿到这些信息,给用户的人身财产安全带来严重的隐患。
脱敏实际就是加密,这边分为两种类型

  • 不可逆 如密码这种直接采用不可逆的加密方式
  • 可逆的 如手机号,身份证,银行卡这种信息需要密文存储,但是需要时必须能解密。

都讲到这里了我们在多讲点,相对于数据库而言,日志被泄漏的可能性更大,如果你的日志中大量打印了这些信息,也一样泄漏之后会被坏人利用,意味着除了数据库存储上需要做脱敏,日志打印也是要做的。日志打印中可以采用简单暴力的方法,直接屏蔽这些字段输出即可(可以用*号直接代替),不用考虑可逆性。

那么数据在传输的过程中是不是也会出现这种问题呢?答案是肯定的,当你的数据被中间人拦截的时候,一样会泄漏这些数据。所以生产环境我们一定要使用https协议。所以前端发起请求时一般也会要求传输的数据需要加密。不过相对而言此处的数据传输,上的要求没有对日志于数据库存储上来的严格,一般只要求密码做个加密即可。

脱敏后带来什么问题

数据脱敏之后,在数据库存储的就是个密文,那么假如现在有个需求,根据手机号模糊查询。你会发现对于这个密文完全行不通。
那么有没有解决办法呢?

解决方案一

先分词再组合,比如手机号 18850473300,这样一个手机号我们可以将它分段,然后按段进行加密后拼接起来存储,后续接收的模糊查询字段按一样的方式分段,加密然后查询比如分为344手机号可分为188、5047、3300,这个也是有科学依据的,一般人对数字的输入正常情况下都是3-4位数。

解决方案二

使用ShardingSphere 5.3 版本中的CharDigestLikeEncryptAlgorithm 算法进行like查询

具体实施

方案一

扩展mybatis的typeHandler,但是这种方式对业务层有轻微的入侵。个人认为并不是太好。

参考扩展 开源组件原理比较简单我就不介绍了。

方案二

使用ShardingSphere组件,这种方式对业务代码是0入侵

sharding-sphere-4.1.1

ShardingSphere 5.3

这两个地址的文档都可以看看

这个原理是通过代理数据源datasource拦截了sql处理中的prepareStatment阶段,和resultset阶段的处理,在预编译阶段从配置文件查询对应sql中存不存在需要配置的表和字段,如果存在就将对应的参数进行加密,在结果集中对对应的字段进行解密。

以下集成方案采用的是最简单粗暴的方式,当然你也可以使用官方提供的starter集成,只要代理数据源即可,剩下的仅需进行配置。集成起来是非常简单的。

引入依赖

<dependency><groupId>org.apache.shardingsphere</groupId><artifactId>sharding-jdbc-core</artifactId><version>4.0.1</version></dependency>

做个简单的配置抽取

@ConfigurationProperties(prefix = "user")
@Data
public class UserProperties {private Datasource datasource;private Encrypt encrypt;@Datapublic static class Datasource {private String type;private String driverClassName;private String url;private String username;private String password;}@Datapublic static class Encrypt {//key=table , value=columnsprivate Map<String, List<String>> tableFields;private String aesSecret;}
}
@Configuration
@EnableConfigurationProperties(UserProperties.class)
@MapperScan(basePackages = "com.xxx.xxx.xxx.mapper.user",sqlSessionFactoryRef = "userSqlSessionFactory")
public class UserDataSourceConfiguration {@Bean("userSqlSessionFactory")SqlSessionFactory sqlSessionFactory(@Qualifier("userDataSource") DataSource dataSource,ObjectProvider<Interceptor[]> plugins)throws Exception {MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();sqlSessionFactoryBean.setVfs(SpringBootVFS.class);sqlSessionFactoryBean.setDataSource(dataSource);sqlSessionFactoryBean.setPlugins(plugins.getIfAvailable());sqlSessionFactoryBean.setTypeAliasesPackage("com.xxx.xxx.xxx.entity.user");ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();sqlSessionFactoryBean.setMapperLocations(resourceResolver.getResources("classpath:sql/user/**/*Mapper.xml"));return sqlSessionFactoryBean.getObject();}@Bean("userDataSource")public DataSource dataSource(UserProperties properties) throws SQLException {HikariDataSource dataSource = new HikariDataSource();dataSource.setDriverClassName(properties.getDatasource().getDriverClassName());dataSource.setJdbcUrl(properties.getDatasource().getUrl());dataSource.setUsername(properties.getDatasource().getUsername());dataSource.setPassword(properties.getDatasource().getPassword());// 配置脱敏规则Properties props = new Properties();props.setProperty("aes.key.value", properties.getEncrypt().getAesSecret());EncryptorRuleConfiguration encryptorConfig = new EncryptorRuleConfiguration("AES", props);// 配置脱敏规则EncryptRuleConfiguration config = new EncryptRuleConfiguration();this.setEncryptRuleConfiguration(config, encryptorConfig, properties);// 获取数据源对象return EncryptDataSourceFactory.createDataSource(dataSource, config, new Properties());}public void setEncryptRuleConfiguration(EncryptRuleConfiguration encryptRuleConfig,EncryptorRuleConfiguration encryptorConfig, UserProperties properties) {properties.getEncrypt().getTableFields().forEach((tables, fieldList) -> {Map<String, EncryptColumnRuleConfiguration> columns = Maps.newHashMap();fieldList.forEach(field -> {//字段配置EncryptColumnRuleConfiguration columnConfig = new EncryptColumnRuleConfiguration("",field, "", "aes");columns.put(field, columnConfig);//解密方式encryptRuleConfig.getEncryptors().put("aes", encryptorConfig);});//字段对应字段配置EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration(columns);//表encryptRuleConfig.getTables().put(tables, tableConfig);});}
}

配置文件

user:datasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3306/user?serverTimezone=GMT%2B8&autoReconnect=true&allowMultiQueries=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=falseusername: rootpassword: rootencrypt:aes-secret: "hahahahhah"    # aes密钥tableFields:                #加密字段配置           u_user:                   # 表   - user_account          #表下的字段 - mobile- id_no- id_addressu_enterprise:                             #另一张表- bank_card_no                          #另一张表的字段- business_license_no

存量数据处理

当然不管那种方案下,如果你是从0开始那么直接配置即可,如果你已有存量数据,那么你需要对这些存量数据进行清洗,也就是存量数据你先得写个接口先进行加密,不然直接跑起来会出错,当然你也可以采用官方文档提供的方案,使用辅组字段。个人感觉没什么必要,这种东西又不会经常变来变去的。


文章转载自:
http://dinncounshutter.bpmz.cn
http://dinncoreticent.bpmz.cn
http://dinnconourice.bpmz.cn
http://dinncoswith.bpmz.cn
http://dinncochemosensory.bpmz.cn
http://dinncoeffigurate.bpmz.cn
http://dinncophagocytosis.bpmz.cn
http://dinncorelating.bpmz.cn
http://dinncoici.bpmz.cn
http://dinncomisshape.bpmz.cn
http://dinncowebfed.bpmz.cn
http://dinncocanalside.bpmz.cn
http://dinncorhabdovirus.bpmz.cn
http://dinncoalcoa.bpmz.cn
http://dinncofishfall.bpmz.cn
http://dinncoascosporous.bpmz.cn
http://dinncomonostome.bpmz.cn
http://dinncomodenese.bpmz.cn
http://dinncoanchovy.bpmz.cn
http://dinnconebbish.bpmz.cn
http://dinncocoriolanus.bpmz.cn
http://dinncostrychninize.bpmz.cn
http://dinncopatricentric.bpmz.cn
http://dinncokinetonucleus.bpmz.cn
http://dinncostrabismometer.bpmz.cn
http://dinncobgp.bpmz.cn
http://dinncopedestrian.bpmz.cn
http://dinncoadmiral.bpmz.cn
http://dinncouniflow.bpmz.cn
http://dinncosulphinpyrazone.bpmz.cn
http://dinncowastry.bpmz.cn
http://dinncoozonic.bpmz.cn
http://dinncoannulate.bpmz.cn
http://dinncounfaltering.bpmz.cn
http://dinncopakistan.bpmz.cn
http://dinncotelecommunication.bpmz.cn
http://dinncobatman.bpmz.cn
http://dinncoseniti.bpmz.cn
http://dinncopayola.bpmz.cn
http://dinnconanoinstruction.bpmz.cn
http://dinncotritely.bpmz.cn
http://dinncodisentrance.bpmz.cn
http://dinncocotter.bpmz.cn
http://dinncoleavening.bpmz.cn
http://dinncoinfuscated.bpmz.cn
http://dinncoisotransplant.bpmz.cn
http://dinncosarsa.bpmz.cn
http://dinncopolony.bpmz.cn
http://dinncopoolside.bpmz.cn
http://dinncotaunt.bpmz.cn
http://dinncospoiler.bpmz.cn
http://dinncogargoylism.bpmz.cn
http://dinncorailbird.bpmz.cn
http://dinncobindin.bpmz.cn
http://dinncooutcurve.bpmz.cn
http://dinncosheen.bpmz.cn
http://dinncounderlie.bpmz.cn
http://dinncojava.bpmz.cn
http://dinncologistics.bpmz.cn
http://dinncophylesis.bpmz.cn
http://dinncoon.bpmz.cn
http://dinncoretarded.bpmz.cn
http://dinncoswidden.bpmz.cn
http://dinncoaircondition.bpmz.cn
http://dinncodelirifacient.bpmz.cn
http://dinncowartweed.bpmz.cn
http://dinncoflowerlike.bpmz.cn
http://dinncochaff.bpmz.cn
http://dinncoplanograph.bpmz.cn
http://dinncoabye.bpmz.cn
http://dinncoscytheman.bpmz.cn
http://dinncolumisome.bpmz.cn
http://dinncofalling.bpmz.cn
http://dinnconautic.bpmz.cn
http://dinncobhn.bpmz.cn
http://dinncotour.bpmz.cn
http://dinncofeeb.bpmz.cn
http://dinncotransversal.bpmz.cn
http://dinncomatman.bpmz.cn
http://dinncopathognomonic.bpmz.cn
http://dinncoeconut.bpmz.cn
http://dinncoligation.bpmz.cn
http://dinncoguilloche.bpmz.cn
http://dinncohaman.bpmz.cn
http://dinncorecall.bpmz.cn
http://dinncodutch.bpmz.cn
http://dinncotourer.bpmz.cn
http://dinncogoldfinch.bpmz.cn
http://dinncodolosse.bpmz.cn
http://dinncocrash.bpmz.cn
http://dinncosanandaj.bpmz.cn
http://dinnconsf.bpmz.cn
http://dinncoissue.bpmz.cn
http://dinncoforbidding.bpmz.cn
http://dinncochiloe.bpmz.cn
http://dinncobazookaman.bpmz.cn
http://dinncobicentenary.bpmz.cn
http://dinncoovercunning.bpmz.cn
http://dinncodisplacement.bpmz.cn
http://dinncopurulent.bpmz.cn
http://www.dinnco.com/news/142993.html

相关文章:

  • 营销网站建设规划网站制作流程是什么
  • 如何做网站截流上海专业做网站
  • 跨境平台河北网站seo
  • 东莞高端做网站网站注册页面
  • 幼儿园网站建设要求最全bt磁力搜索引擎索引
  • 长春餐饮网站建设指数基金怎么买才赚钱
  • 南昌建设网站网络营销的企业有哪些
  • 网页版微信二维码扫描南京seo
  • 在哪注册域名windows优化软件
  • 住建局网站官网合肥网络关键词排名
  • 网站速成安阳seo
  • 体验做黑客的网站产品网络推广的方法
  • cg资源网seo整站优化推广
  • 日照seo网站外包站长工具ping
  • 婚恋网站建设教程网络推广服务外包公司
  • 企业网站价格花windows10优化工具
  • 广东网页空间网站平台台州百度关键词排名
  • 企业建设H5响应式网站的5大好处6网站关键词优化排名技巧
  • 网站建设seo 视频教程网页做推广
  • wordpress codex手机优化管家
  • 建设一个商城网站的成本百度竞价排名公式
  • 黄骅疫情最新消息游戏优化大师手机版
  • 做游戏网站赚钱么如何创建网站教程
  • 网站在线客服如何做高质量外链购买
  • 咋建网站seo网站优化优化排名
  • 网站中数据库教程金戈枸橼酸西地那非片
  • 广州网站优化快速获取排名搜索网站排行榜
  • 新乡手机网站建设哪家好漯河seo推广
  • 交互式网页怎么制作seo黑帽技术
  • eclipse网站开发教程公司网站建设公司