1. Step: Create Keys
LicenceMe uses Partial Key Verification (PKV) to create and validate product keys. To do this you need some public and private key. The private key is used to create product keys and the public to validate those.
You can either create thoses keys through the gui (Unity->Window->LicenceMe Settings):
Or through code:
1 2 3 4 5 6 7 |
FileStoring serverPkvStoring = new FileStoring(Application.dataPath + "/OPS/LicenceMe/Editor/PkvKey/PrivateKey.xml"); FileStoring clientPkvStoring = new FileStoring(Application.dataPath + "/OPS/LicenceMe/Resources/OPS/LicenceMe/PkvKey/PublicKey.xml"); int subKeyLength = 4; OPS.LicenceMe.Server.ServerKeyManager.CreateNewPkvSubKeys(subKeyLength, serverPkvStoring, clientPkvStoring); |
2. Step: Create a product key
The product key creation uses the created private key to create some new product key.
You can either create a product key through the gui:
Or through code:
1 2 3 4 5 6 |
Storing.FileStoring serverPkvStoring = new FileStoring(Application.dataPath + "/OPS/LicenceMe/Editor/PkvKey/PrivateKey.xml"); int spacing = 6; String condition = ""; String newProducKey = OPS.LicenceMe.Server.ServerProductKeyManager.CreateProductKeyForUserWithCondition(spacing, serverPkvStoring, condition); |
3. Step: Validate a product key
The product key validation uses the public key for validation.
Again this can be done through the gui.
Or more recommended through code:
1 2 3 4 5 6 |
Storing.ResourcesStoring clientPkvStoring = new ResourcesStoring("OPS/LicenceMe/PkvKey/PublicKey"); String productKey; String condition; bool validationResult = OPS.LicenceMe.Client.ClientProductKeyManager.ValidateProductKeyWithCondition(clientPkvStoring , productKey, condition); |