Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to customize desensitization rules by SharedingSphere

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces SharedingSphere how to customize the desensitization rules, the article is very detailed, has a certain reference value, interested friends must read it!

Official default desensitization

You can see that the Type used is the aes algorithm,

How do we implement our own custom rules. Implement interface org.apache.shardingsphere.encrypt.strategy.spi.Encryptor

two。 Modify yml configuration file

Here the encryption type is written as its own custom, which can be done at will.

Then add Type to your own implementation class.

Write init methods

Private final static String TYPE = "custom-aes"; private static final String SHARDING_PROPERTIES = "properties/sharding.properties"; private Properties properties; @ Override public void init () {try {properties = PropertiesLoaderUtils.loadAllProperties (SHARDING_PROPERTIES);} catch (IOException e) {log.error ("failed to read sharding configuration file," + e.getMessage (), e) Throw new RuntimeException ("failed to read sharding configuration file," + e.getMessage (), e);}}

We will implement the Properties get/set method after the initial completion.

Then comes the most important part, which is to customize the encryption and decryption rules.

Here, you can customize your own implementation.

By the way, the document also says ase.key.value, which we can define in the Properties file and read in.

This method is in our custom encrypted key.

Finally, we need to configure our custom package path to the automatic assembly path of springboot.

The above is all the content of this article "how to customize the desensitization rules of SharedingSphere". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report