We have a C# application and need to protect it against illegal copying. So we decided to use the Portable.Licensing
library to protect our system.
How I can tie a license to hardware id in Portable.Licensing
, so that only a specific PC can use license?
You can generate a unique hash over the PC's name, hardware information, etc. and add this hash as Additional Attribute
during the license creation.
Example of license creation:
var license = License.New()
.WithUniqueIdentifier(Guid.NewGuid())
.As(LicenseType.Standard)
.WithMaximumUtilization(1)
.WithAdditionalAttributes(new Dictionary<string, string>
{
{"HardwareId", "........"}
})
.LicensedTo("John Doe", "[email protected]")
.CreateAndSignWithPrivateKey(privateKey, passPhrase);
To validate the attribute you can implement your own validation extension method or just use the existing AssertThat()
. Example: [1]
The generation of a unique hardware id is out of the scope of portable licensing.