MeterOwdDb: - denied password build if skeletonKey == passwordLvl8

This commit is contained in:
Thomas Wiedebusch
2023-10-10 18:15:17 +02:00
parent e6300a7563
commit c074c83e6a
4 changed files with 15 additions and 10 deletions
+1 -1
View File
@@ -155,7 +155,7 @@
</site>
<site name="MeterProcessState" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" />
@@ -113,7 +113,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// <summary>
/// Build the password file out of the clear text passwords.
/// The Level 3 password is already preset.
/// The Level 3 password is already preset with skeletonKey.
/// </summary>
/// <param name="pwdLevels">8 sorted passwords levels: 1, 2, 3, 4, 5, 6, 7, 8</param>
/// <param name="processorUid">unique ID of processor used for password level 3</param>
@@ -127,11 +127,18 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// - Password Level 3 will be compared with data base skeletonKey,
/// - SHA 1 of passwords.
/// </remarks>
/// <remarks date="2023-Oct-10" author="Thomas Wiedebusch">
/// - Check if skeletonKey is overwritten with passwordLvl8.
/// </remarks>
public Boolean BuildPwdFile(List<Byte[]> pwdLevels, UInt64 processorUid, String dbSkeletonKey)
{
if (!Encoding.UTF8.GetBytes(dbSkeletonKey).SequenceEqual(pwdLevels[2]))
if (!Encoding.UTF8.GetBytes(dbSkeletonKey).SequenceEqual(pwdLevels[MeterPwdDb.SkeletonKeyIdx]))
{
throw new ApplicationException("Level 3 Password is unequal to the old Data Base Content!");
throw new ApplicationException("SkeletonKey is not set on password file level 3!");
}
if (Encoding.UTF8.GetBytes(dbSkeletonKey).SequenceEqual(pwdLevels[MeterPwdDb.PwdLevel8Idx]))
{
throw new ApplicationException("SkeletonKey is overwritten with passwordLvl8!");
}
var ret = new List<Byte>();
@@ -209,10 +216,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// <summary>
/// Verify Meter password file
/// generated passowrd file has to be present
/// generated password file has to be present
/// </summary>
/// <returns></returns>
/// <remarks date="2023-JAn-24" author="Thomas Wiedebusch&Roalnd Drabesch">
/// <remarks date="2023-JAn-24" author="Thomas Wiedebusch/Roland Drabesch">
/// - Initial.
/// </remarks>
@@ -222,9 +229,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
{
return false;
}
return _meterFile.VerifyMeterFile(StrPasswordFileName, _hashedPasswordFile);
}
/// <summary>
@@ -1 +1 @@
c43c40a030005a8f189e6179faf40a6d42bfef5c
bf6bb8fceb3db5a9977dadc407cf576684bf7127
@@ -1 +1 @@
65d75c3322f8a137c69963cfdc0cb6f1ffacf62a
247396738e2c5d26ac00f9df05c0cc5c61d7f33a