justbk2015 opened a new pull request #11440:
URL: https://github.com/apache/shardingsphere/pull/11440


   Fixes #11434.
   
   Changes proposed in this pull request:
   - add prop PROXY_BACKEND_ALGORITHM and PROXY_FRONTEND_ALGORITHM to config 
password encrypt algorithm, default is NONE, that mains nothing to do
   - add AES password encrypt algorithm
   - anyone can implements AlgorithmSecure interface for new algorithm
   
   examples:
   add server.yaml config in props:
     proxy-backend-algorithm: AES  --this is for config-sharding.yaml's 
dataSource password encrypt
     proxy-frontend-algorithm: AES  -- this is for server.yaml rule's authority 
password encrypt
   
![image](https://user-images.githubusercontent.com/12265143/126469682-c74cc686-1bb2-4bf0-b25f-249b569eada0.png)
   
   in config file like this:
   for backend algorithm:
   
![image](https://user-images.githubusercontent.com/12265143/126469195-56ec4d13-5582-4ecb-9c3e-f46045dda3e7.png)
   for frontend algorithm:
    
   
![image](https://user-images.githubusercontent.com/12265143/126469355-a32e799a-4e52-4787-8174-726f2f790e69.png)
   
   to get password, you can simple run algorithm:
   ---
   import org.apache.shardingsphere.infra.security.AesAlgorithmSecure;
   
   public class Main {
       public static void main(String ... args) throws Exception {
           String plaint = "sharding";
           AesAlgorithmSecure util = new AesAlgorithmSecure();
   
           String encryptStr = util.encrypt(plaint);
           System.out.println("Encrypt: " + encryptStr);
   
           String decrypt = util.decrypt(encryptStr);
           System.out.println("Decrypt: " + decrypt);
       }
   }
   ---
   result:
   Encrypt: TXdQa74U8xed9457/sfIuDnuu7PI8I6hL4IWCy/B0PVopdKwEhZCacukz9k0vhaL
   Decrypt: sharding
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to