diff --git a/.gitignore b/.gitignore index 76c46bc44dfd264fcc5767a35f0aaa33be70fbe3..844b3908781948a0a06c1791a089b0cf54dc4a80 100644 --- a/.gitignore +++ b/.gitignore @@ -197,3 +197,4 @@ VectoCore/VectoCoreTest/TestData/XML/XSD/ VectoCommon/VectoHashingTest/Testdata/XML/XSD/ VectoCore/VectoCoreTest/TestData/Integration/DeclarationMode/**.vmod VectoCore/VectoCoreTest/TestData/Integration/DeclarationMode/**.vsum +Coverage/ diff --git a/VectoCommon/VectoHashing/Impl/XmlHashProvider.cs b/VectoCommon/VectoHashing/Impl/XmlHashProvider.cs index 57001c4078940fef1d8c30704a3fe749b79e5dbc..9bdddd9523544ede53b865b5e7da5c7fb5d20feb 100644 --- a/VectoCommon/VectoHashing/Impl/XmlHashProvider.cs +++ b/VectoCommon/VectoHashing/Impl/XmlHashProvider.cs @@ -29,37 +29,37 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ -using System; -using System.Security.Cryptography; -using System.Security.Cryptography.Xml; -using System.Xml; - -namespace TUGraz.VectoHashing.Impl -{ - public class XMLHashProvider - { - public static XmlDocument ComputeHash(XmlDocument doc, string elementId) - { - if (doc == null) { - throw new Exception("Invalid Document"); - } - var signedXml = new SignedXml(doc); - var reference = new Reference("#" + elementId) { - DigestMethod = "http://www.w3.org/2001/04/xmlenc#sha256" - }; - reference.AddTransform(new XmlDsigVectoTransform()); - reference.AddTransform(new XmlDsigExcC14NTransform()); - - - signedXml.AddReference(reference); - signedXml.ComputeSignature(HMAC.Create()); - var xmlDigitalSignature = reference.GetXml(); - - var sigdoc = new XmlDocument(); - sigdoc.CreateElement("Signature"); - sigdoc.AppendChild(sigdoc.ImportNode(xmlDigitalSignature, true)); - - return sigdoc; - } - } +using System; +using System.Security.Cryptography; +using System.Security.Cryptography.Xml; +using System.Xml; + +namespace TUGraz.VectoHashing.Impl +{ + public class XMLHashProvider + { + public static XmlDocument ComputeHash(XmlDocument doc, string elementId) + { + if (doc == null) { + throw new Exception("Invalid Document"); + } + var signedXml = new SignedXml(doc); + var reference = new Reference("#" + elementId) { + DigestMethod = "http://www.w3.org/2001/04/xmlenc#sha256" + }; + reference.AddTransform(new XmlDsigVectoTransform()); + reference.AddTransform(new XmlDsigExcC14NTransform()); + + + signedXml.AddReference(reference); + signedXml.ComputeSignature(HMAC.Create()); + var xmlDigitalSignature = reference.GetXml(); + + var sigdoc = new XmlDocument(); + sigdoc.CreateElement("Signature"); + sigdoc.AppendChild(sigdoc.ImportNode(xmlDigitalSignature, true)); + + return sigdoc; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index a3c29bfca4aa9200810e8a044d1ec48f25d553db..0e96a009d92372a031687c7d240c35012cd41da8 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -118,7 +118,7 @@ namespace TUGraz.VectoCore.Models.Declaration }; public static readonly MeterPerSecond MinSpeed = 50.KMPHtoMeterPerSecond(); - public static readonly MeterPerSecond OverSpeed = 5.KMPHtoMeterPerSecond(); + public static readonly MeterPerSecond OverSpeed = 2.5.KMPHtoMeterPerSecond(); public static readonly MeterPerSecond UnderSpeed = 5.KMPHtoMeterPerSecond(); } diff --git a/VectoCore/VectoCoreTest/Integration/FuelTypesTest.cs b/VectoCore/VectoCoreTest/Integration/FuelTypesTest.cs index b679c853d08e10ef6458f07b589e724e4e4b6100..fb88222b7bcfbfb2652649d7d72ab80a4d7ac76f 100644 --- a/VectoCore/VectoCoreTest/Integration/FuelTypesTest.cs +++ b/VectoCore/VectoCoreTest/Integration/FuelTypesTest.cs @@ -43,16 +43,16 @@ namespace TUGraz.VectoCore.Tests.Integration public class FuelTypesTest { [TestCase(FuelType.DieselCI, - @"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 0, 0.0006886, 9392.6020, + @"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 0, 0.0006886, 9391.5411, TestName = "Diesel LH Low"), TestCase(FuelType.EthanolCI, - @"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 0, 0.00040262, 5653.1586, + @"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 0, 0.00040262, 5652.5200, TestName = "Ethanol LH Low"), TestCase(FuelType.DieselCI, - @"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 1, 0.0007971, 10871.1489, + @"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 1, 0.0007971, 10877.1820, TestName = "Diesel LH Ref"), TestCase(FuelType.EthanolCI, - @"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 1, 0.0004660, 6543.0568, + @"TestData\Integration\DeclarationMode\Class2_RigidTruck_4x2\Class2_RigidTruck_DECL.vecto", 1, 0.0004660, 6546.6880, TestName = "Ethanol LH Ref"),] public void TestFuelTypesCO2(FuelType fuelType, string jobName, int runIdx, double expectedCo2, double expectedMJ) {