appsoftwareltd / dotnet-licence-key-generator Goto Github PK
View Code? Open in Web Editor NEWKey Generation and Verification System component .NET Core 1.0+, .NET Framework 4.5+
Key Generation and Verification System component .NET Core 1.0+, .NET Framework 4.5+
We use a seed (user ID) to generate a key, but the same seed is not used to validate the key, so anyone with the same key can activate the app?
if KeyVerification app is decompiled and keyByteSets
known, then the hacker can create another KeyGenerator, using just same keyByteSets
or its superset?
The userId field in sample projects is useless, because when checking the license key, userId field is never used. So when i enter the license key to any program, it acceps. The user can copy my program to another computer and can run it with the same serial.
The code taken from your own sample projects and changed a little bit. i accepts the key
int userId = int.Parse(Console.ReadLine());
// We will use the LicenceServer project in this sample to generate a key.
// In production code, the licence server mechanism would be a separate application
// from the application that verifies the key. This is important so as to protect the
// full KeyByteSet array that was used to generate the key.
var licenceServer = new LicenceServer();
// Generate the licence key using the seed
string licenceKeyStr = licenceServer.GenerateLicenceKey(userId);
Console.WriteLine("\nLicence key generated: " + licenceKeyStr);
Console.WriteLine("\nNow we will verify the licence key. Please type the licence key printed above: ");
var result = PkvLicenceKeyResult.KeyInvalid;
while (result != PkvLicenceKeyResult.KeyGood)
{
string userEnteredLicenceKeyStr = licenceServer.GenerateLicenceKey(1);
Console.WriteLine(userEnteredLicenceKeyStr);
//Console.ReadLine();
var pkvKeyCheck = new PkvKeyCheck();
// Here we recreate a subset of the full original KeyByteSet array that
// was used to create the licence key. Note the argument to keyByteNo in
// each matches that in the full KeyByteSet array.
var keyBytes = new[] {
new KeyByteSet(5, 165, 15, 132),
new KeyByteSet(6, 128, 175, 213)
};
result = pkvKeyCheck.CheckKey(userEnteredLicenceKeyStr, keyBytes, 8, null);
if (result != PkvLicenceKeyResult.KeyGood)
{
Console.WriteLine("\nResult is: " + result.ToString() + ". Please try again.");
}
}
Just a small issue I noticed on your .Tests project.
You are creating new instances of Random inside loop. That will not generate random number each loop. You can see that yourself by outputting your seed to console. Right now it would generate 100-200 unique seeds instead of 10000, what the loop tries to do.
To fix the issue, you have to instantiate Random outside of your loop and use the reference inside, that will guarantee new seed each time.
Trying to clarify the license of this library.
As there is currently no license attributed, and language in the readme talking about a 30 day trial I am assuming this is available via a commercial license?
If it is intended to be used free of charge, please apply a license that allows this, else it cannot legally be used by others in their projects. See https://help.github.com/articles/open-source-licensing/
Thanks!
I have used SharpDevelop to convert the code to VB,NET and I understand that I can use the same dll's that are bundled. Still, I am having issues regarding these lines, after conversion:
[error] Type expected. (BC30182) @ Sample1.Server.ConvertedToVBNet\LicenceServer.vb:19,22 >>
Dim keyGenerator = New PkvLicenceKeyGenerator()
[error] 'keyBytes' is not declared. It may be inaccessible due to its protection level @ \Sample1.Server.ConvertedToVBNet\LicenceServer.vb:22,52 >>
Dim key As String = keyGenerator.MakeKey(userId, keyBytes)
Any help would be highly appreciated.
it is possible to enhance the library, so the key generator can input other information, such as quota number, and in PkvKeyVerificationResult to have that number?
the information could be in key value pair to satisfy generic needs.
How to forbid one license for unlimited use on different PC?
I am trying to incorporate a hardware serial number into the key so it has to match when validating the product code. I have changed one of the keybytes to be the serial number and use the product code generated. When I put in the product code and use the same keybytes, I find that multiple serial numbers will be validated.
Any suggestions on how to accomplish using a serial number at time of checking the product code?
not sure what think othe rbut I think is weak part of your solutions....
"Light weight and fast code execution, tested up to 1,000,000 key generation and verification cycles in 10.2 seconds."
So far i love the generator but im running into an issue adding seeds to the blacklisted seeds array. I added them to a List and convert to an array in the blackListedSeeds call. Key is still showing valid. Any suggestions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.