-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
43 lines (38 loc) · 1.44 KB
/
Copy pathProgram.cs
File metadata and controls
43 lines (38 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BASeCamp.Licensing;
namespace LicenseKeyTest
{
class Program
{
static void Main(string[] args)
{
StandardKey lk = new StandardKey();
lk.ExpiryDate = DateTime.Now.AddMonths(1);
lk.LicensedEdition = StandardKey.Edition.Professional;
lk.LicensedUsers = 50;
lk.LicensedMajorVersion = 8;
lk.LicensedMinorVersion = 2;
String sKey = CryptHelper.InsertDashes(LicenseHandler.ToProductCode<StandardKey>(lk, CryptHelper.LocalMachineID));
Console.WriteLine(lk);
Console.WriteLine("Generated Product Key:" + sKey);
Console.WriteLine("Decrypting Product Key...");
StandardKey decryptKey = LicenseHandler.FromProductCode<StandardKey>(sKey, CryptHelper.LocalMachineID);
Console.WriteLine("Decrypted Result:" + decryptKey.ToString());
sKey = "5" + sKey.Substring(1);
Console.WriteLine("Changed one character in key- using " + sKey);
try
{
StandardKey faildecrypt = LicenseHandler.FromProductCode<StandardKey>(sKey, CryptHelper.LocalMachineID);
}
catch (Exception exx)
{
Console.WriteLine("Exception:" + exx.Message);
}
Console.ReadKey();
}
}
}