How to avoid storing passwords in the clear for tomcat's server.xml Resource definition of a DataSource?

前端 未结 9 1962

The resource definition in tomcat\'s server.xml looks something like this...



        
9条回答
  •  甜味超标
    2020-12-01 00:45

    We use C#'s SHA1CryptoServiceProvider

    print(SHA1CryptoServiceProvider sHA1Hasher = new SHA1CryptoServiceProvider();
            ASCIIEncoding enc = new ASCIIEncoding();
    
            byte[] arrbytHashValue = sHA1Hasher.ComputeHash(enc.GetBytes(clearTextPW));
            string HashData = System.BitConverter.ToString(arrbytHashValue);
            HashData = HashData.Replace("-", "");
            if (HashData == databaseHashedPassWO)
            {
                return true;
            }
            else
            {
                return false;
            });
    

    )

提交回复
热议问题