Refactor deployment script and replace RNGCryptoServiceProvider
Some checks failed
Build .NET Project / build (push) Has been cancelled
Some checks failed
Build .NET Project / build (push) Has been cancelled
This commit is contained in:
24
Axiom/Axiom.Core/Axiom.Core.sln
Normal file
24
Axiom/Axiom.Core/Axiom.Core.sln
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.5.2.0
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Axiom.Core", "Axiom.Core.csproj", "{379CF069-D825-5068-77C8-E340F5D2FC2D}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{379CF069-D825-5068-77C8-E340F5D2FC2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{379CF069-D825-5068-77C8-E340F5D2FC2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{379CF069-D825-5068-77C8-E340F5D2FC2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{379CF069-D825-5068-77C8-E340F5D2FC2D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {7DE04B9E-BE44-48A3-9B4D-C40BA39CC963}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -16,21 +16,36 @@ namespace MarketData.Security
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public static (string Salt, string Hash) HashPasswordWithSalt(string password)
|
||||||
|
// {
|
||||||
|
// using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
|
||||||
|
// {
|
||||||
|
// byte[] salt = new byte[16];
|
||||||
|
// rng.GetBytes(salt);
|
||||||
|
// using (SHA256 sha256 = SHA256.Create())
|
||||||
|
// {
|
||||||
|
// byte[] passwordBytes = Encoding.UTF8.GetBytes(password);
|
||||||
|
// byte[] saltedPassword = new byte[passwordBytes.Length + salt.Length];
|
||||||
|
// Buffer.BlockCopy(passwordBytes, 0, saltedPassword, 0, passwordBytes.Length);
|
||||||
|
// Buffer.BlockCopy(salt, 0, saltedPassword, passwordBytes.Length, salt.Length);
|
||||||
|
// byte[] hashBytes = sha256.ComputeHash(saltedPassword);
|
||||||
|
// return (Convert.ToBase64String(salt), Convert.ToBase64String(hashBytes));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
public static (string Salt, string Hash) HashPasswordWithSalt(string password)
|
public static (string Salt, string Hash) HashPasswordWithSalt(string password)
|
||||||
{
|
{
|
||||||
using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
|
byte[] salt = new byte[16];
|
||||||
|
RandomNumberGenerator.Fill(salt);
|
||||||
|
using (SHA256 sha256 = SHA256.Create())
|
||||||
{
|
{
|
||||||
byte[] salt = new byte[16];
|
byte[] passwordBytes = Encoding.UTF8.GetBytes(password);
|
||||||
rng.GetBytes(salt);
|
byte[] saltedPassword = new byte[passwordBytes.Length + salt.Length];
|
||||||
using (SHA256 sha256 = SHA256.Create())
|
Buffer.BlockCopy(passwordBytes, 0, saltedPassword, 0, passwordBytes.Length);
|
||||||
{
|
Buffer.BlockCopy(salt, 0, saltedPassword, passwordBytes.Length, salt.Length);
|
||||||
byte[] passwordBytes = Encoding.UTF8.GetBytes(password);
|
byte[] hashBytes = sha256.ComputeHash(saltedPassword);
|
||||||
byte[] saltedPassword = new byte[passwordBytes.Length + salt.Length];
|
return (Convert.ToBase64String(salt), Convert.ToBase64String(hashBytes));
|
||||||
Buffer.BlockCopy(passwordBytes, 0, saltedPassword, 0, passwordBytes.Length);
|
|
||||||
Buffer.BlockCopy(salt, 0, saltedPassword, passwordBytes.Length, salt.Length);
|
|
||||||
byte[] hashBytes = sha256.ComputeHash(saltedPassword);
|
|
||||||
return (Convert.ToBase64String(salt), Convert.ToBase64String(hashBytes));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -234,3 +234,11 @@ Also note that 1>/dev/null is synonymous to, but more explicit than >/dev/null
|
|||||||
|
|
||||||
# Financial
|
# Financial
|
||||||
1) Economic Indicators - https://docs.tradingeconomics.com/
|
1) Economic Indicators - https://docs.tradingeconomics.com/
|
||||||
|
|
||||||
|
|
||||||
|
# DOTNET related notes
|
||||||
|
Slow builds and C# Dev Kit Errors
|
||||||
|
ps -u $USER -o pid,cmd | grep -E 'csdevkit|visualstudio-projectsystem-buildhost|vstest.console' | grep dotnet | awk '#{print $1}' | xargs -r kill -9 || true
|
||||||
|
|
||||||
|
This shows where dotnet performance is
|
||||||
|
dotnet build /clp:PerformanceSummary
|
||||||
@@ -11,8 +11,10 @@
|
|||||||
# set xtrace if you want to see trace level
|
# set xtrace if you want to see trace level
|
||||||
#set -o xtrace
|
#set -o xtrace
|
||||||
|
|
||||||
sudo service cron stop
|
# use systemctl so we can bypass the pager
|
||||||
sudo service cron status
|
sudo systemctl --no-pager stop cron
|
||||||
|
sudo systemctl --no-pager status cron
|
||||||
|
|
||||||
|
|
||||||
# The name of the MK process that we will need to ensure is not running during the deployment
|
# The name of the MK process that we will need to ensure is not running during the deployment
|
||||||
PROCESS_NAME="mk"
|
PROCESS_NAME="mk"
|
||||||
@@ -74,7 +76,8 @@ done
|
|||||||
# Check if source directory exists
|
# Check if source directory exists
|
||||||
if [ ! -d "$SOURCE_DIR" ]; then
|
if [ ! -d "$SOURCE_DIR" ]; then
|
||||||
echo "Error: Source directory '$SOURCE_DIR' not found."
|
echo "Error: Source directory '$SOURCE_DIR' not found."
|
||||||
sudo service cron restart
|
# use systemctl so we can bypass the pager prompts
|
||||||
|
sudo systemctl --no-pager restart cron
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -122,8 +125,9 @@ echo ""
|
|||||||
|
|
||||||
echo "Files copied from '$SOURCE_DIR' to '$DEST_DIR'."
|
echo "Files copied from '$SOURCE_DIR' to '$DEST_DIR'."
|
||||||
|
|
||||||
sudo service cron restart
|
# use systemctl so we can bypass the pager prompts
|
||||||
sudo service cron status
|
sudo systemctl --no-pager restart cron
|
||||||
|
sudo systemctl --no-pager status cron
|
||||||
|
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user