-
Question |
Beta Was this translation helpful? Give feedback.
Answered by
r-brown
Oct 26, 2023
Replies: 1 comment
-
In order to use Offline validation using License File Please find below sample code for C# library: using System;
using NetLicensingClient.Entities;
namespace NetLicensingClient
{
class NetLicensingClient_demo
{
static int Main(string[] args)
{
string publicKey = @"-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu5grobcnjPhzOvyG05DO
OW6SlUIKa7omhJLIXl8D8fohuHUaZLoGA2Fot4OP/qFSg0DK4egbCbU+pDrasMvK
vNTCMzw0ypzbyBEaYSm6wtEeU45ppawj0HjOh3NRp2Ds0hR8xSMKFRc/4d87hskj
yjKXOqoOZhqjXwYk7ocIe6ADPpF4YCs5eY4/3CL1JnItdlKQRsl8ZJ0Yqe+figf9
agCWvQ0O0faRdmgmr7eUhU9aXNvSJaVJXbg6TjhhxVujzehF8sh/7sxgGwqbyunE
15OWo6dArRCyNUeROu+9Jp4tET+2RA/PuqQbWW6EbJWBhpkqNdzi9CYuhuUjvk8m
dwIDAQAB
-----END PUBLIC KEY-----";
Context offlineContext = new Context();
offlineContext.publicKey = publicKey;
string validationFile = @"<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?><ns2:netlicensing xmlns=""http://www.w3.org/2000/09/xmldsig#"" xmlns:ns2=""http://netlicensing.labs64.com/schema/context"" ttl=""2020-12-28T22:53:06.681Z""><Signature><SignedInfo><CanonicalizationMethod Algorithm=""http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments""/><SignatureMethod Algorithm=""http://www.w3.org/2000/09/xmldsig#rsa-sha1""/><Reference URI=""""><Transforms><Transform Algorithm=""http://www.w3.org/2000/09/xmldsig#enveloped-signature""/></Transforms><DigestMethod Algorithm=""http://www.w3.org/2000/09/xmldsig#sha1""/><DigestValue>ICC1F7ZKeQoayrzn1iGtw7Zt96s=</DigestValue></Reference></SignedInfo><SignatureValue>jYb0aGBPR9Rn4HVRJhBsIRafzW1k3D/GF7GZ62nT8dwvJszGB0kEXdFrXTj7FhUeiBcBlqxcsEUUKA5XbE7LGbNm+V+f5xZu/+n/d/miufKPAIk6CN5xoZQLDRGRSruW0LiKJsnkbzHvIF4u6G/HUyQpUfrxwiqXb+tYFpiaMgcSHL5xGzRq5Mqusw21Cdq81MhUb9oUoujgisIZWqNyebOqWuzOjNJOy0y2uml4I5U5tBAL1OlrQKjfPUiy369HwMl37A7dR9oVcahb6/YPI039xeLTn+WzyFPIV7f41o6Ytq4Iefl6swj/elNKTHi9bYzcnjmM7ebOd+hinm8feA==</SignatureValue></Signature><ns2:infos/><ns2:items><ns2:item type=""ProductModuleValidation""><ns2:property name=""productModuleNumber"">Msb-DEMO</ns2:property><ns2:property name=""valid"">true</ns2:property><ns2:property name=""expires"">2021-04-21T20:15:45.694Z</ns2:property><ns2:property name=""productModuleName"">Module using ""Subscription"" licensing model</ns2:property><ns2:property name=""licensingModel"">Subscription</ns2:property></ns2:item></ns2:items></ns2:netlicensing>";
Console.WriteLine("Offline validation file: {0}", validationFile);
ValidationResult validationOfflineResult = ValidationService.validateOffline(offlineContext, validationFile);
ConsoleWriter.WriteEntity("Offline validation result:", validationOfflineResult);
return 0;
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
r-brown
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In order to use Offline validation using License File
publicKey
need to be set in the validation contect.Please find below sample code for C# library: