예제 #1
0
        public void TestVerifier_Full()
        {
            var expireDate = DateTime.Parse("2100-01-01", CultureInfo.InvariantCulture);
            var license    = Lic.Builder
                             .WithRsaPrivateKey(LicTest.PrivateKey)
                             .WithHardwareIdentifier(HardwareIdentifier.ForCurrentComputer())
                             .WithSerialNumber(SerialNumber.Create("ABC"))
                             .ExpiresOn(expireDate)
                             .WithProperty("Prop1", "Value1")
                             .WithProperty("Prop2", "Value2")
                             .SignAndCreate();

            var verifiedLicense = Lic.Verifier
                                  .WithRsaPublicKey(LicTest.PublicKey)
                                  .WithApplicationCode("ABC")
                                  .LoadAndVerify(license.Serialize());

            Assert.AreEqual(license.Serialize(), verifiedLicense.Serialize());

            verifiedLicense = Lic.Verifier
                              .WithRsaPublicKey(LicTest.PublicKey)
                              .WithApplicationCode("ABC")
                              .LoadAndVerify(license.SerializeAsPlainText());

            Assert.AreEqual(license.Serialize(), verifiedLicense.Serialize());
        }
예제 #2
0
        private static IProcess BuildModuleProcess(ICatalogItemBuilder builder)
        {
            var moduleHelper      = builder.GetHighLevelHelper <IModuleHighLevelHelper>();
            var productIdentifier = new HardwareIdentifier(HardwareIdentifier.NiVendorName, "Rebar Module");
            var module            = moduleHelper.CreateRoot(ModuleKind.Name, "Rebar Module", LocalName, productIdentifier);

            return(module);
        }
예제 #3
0
        public void TestVerify_OneMatchingParts()
        {
            var hardwareID = HardwareIdentifier.ForCurrentComputer();
            var splitted   = hardwareID.Split('-');
            var otherID    = string.Format("1234567890-0987654321-3010203045-" + splitted[3] + "-DummycheckSum");

            Assert.IsFalse(HardwareIdentifier.IsValidForCurrentComputer(otherID));
        }
예제 #4
0
        public void TestVerify_ThreeMatchingParts()
        {
            var hardwareID = HardwareIdentifier.ForCurrentComputer();

            var splitted = hardwareID.Split('-');
            var otherID  = string.Format("12345678-" + splitted[1] + "-" + splitted[2] + "-" + splitted[3] + "-DummycheckSum");

            Assert.IsTrue(HardwareIdentifier.IsValidForCurrentComputer(otherID));
        }
예제 #5
0
        public void Test_hardware_identifier_structure()
        {
            var hardwareID = HardwareIdentifier.ForCurrentComputer();
            var split      = hardwareID.Split('-');

            Assert.AreEqual(5, split.Length);
            Assert.AreEqual(8, split[0].Length);
            Assert.AreEqual(8, split[1].Length);
            Assert.AreEqual(8, split[2].Length);
            Assert.AreEqual(8, split[3].Length);
            Assert.AreEqual(4, split[4].Length);
        }
예제 #6
0
        public void Test_verify()
        {
            var hardwareID = HardwareIdentifier.ForCurrentComputer();

            Assert.IsTrue(HardwareIdentifier.IsValidForCurrentComputer(hardwareID));
        }
예제 #7
0
 public void Test_verify_crap_string() => Assert.IsFalse(HardwareIdentifier.IsValidForCurrentComputer("dsfdsaf<df"));
예제 #8
0
 public void Test_verify_empty_string()
 {
     Assert.IsFalse(HardwareIdentifier.IsValidForCurrentComputer(""));
 }
예제 #9
0
 public void Test_verify_null() => TestHelper.AssertException <ArgumentNullException>(() => HardwareIdentifier.IsValidForCurrentComputer(null));
예제 #10
0
 public void TestArePartialEqual_TwoTrue2() => Assert.IsTrue(HardwareIdentifier.ArePartialEqual("ABC-DEF-123", "ABC-DEF-123"));
예제 #11
0
 public void TestVerify_ZeroMatchingParts() => Assert.IsFalse(HardwareIdentifier.IsValidForCurrentComputer("12345678-09876543-09876543-12345678-0987"));
예제 #12
0
 public void TestArePartialEqual_FiveFalse2() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-JKL-MNO-123", "AAA-DDD-GGG-JJJ-MMM-123"));
예제 #13
0
 public void TestArePartialEqual_FiveTrue2() => Assert.IsTrue(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-JKL-MNO-123", "ABC-DEF-GHI-JJJ-MMM-123"));
예제 #14
0
 public void TestArePartialEqual_FourFalse1() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-JKL-123", "ABC-DDD-GGG-JJJ-345"));
예제 #15
0
 public void TestArePartialEqual_FourTrue1() => Assert.IsTrue(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-JKL-123", "ABC-DEF-GHI-JKL-123"));
예제 #16
0
 public void TestArePartialEqual_ThreeFalse2() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-123", "AAA-DDD-GGG-345"));
예제 #17
0
 public void TestArePartialEqual_ThreeTrue2() => Assert.IsTrue(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-123", "ABC-DEF-GGG-345"));
예제 #18
0
 public void TestArePartialEqual_TwoFalse() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("ABC-DEF-123", "CCC-DDD-345"));
예제 #19
0
 public void TestArePartialEqual_OneTrue() => Assert.IsTrue(HardwareIdentifier.ArePartialEqual("ABC-123", "ABC-345"));
예제 #20
0
 public void TestArePartialEqual_Empty() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("", ""));
예제 #21
0
 public void TestArePartialEqual_DifferentLength() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("ABC-DEF-GHI-JKL-123", "ABC-DEF-GHI-JKL"));
예제 #22
0
 public void TestArePartialEqual_OneFalse() => Assert.IsFalse(HardwareIdentifier.ArePartialEqual("ABC-123", "DDD-345"));