|
1 | 1 | using System;
|
2 | 2 | using System.Collections.Generic;
|
3 | 3 | using System.Linq;
|
| 4 | +using System.Runtime.InteropServices; |
4 | 5 | using NetLicensingClient.Entities;
|
5 | 6 |
|
6 | 7 | namespace NetLicensingClient
|
@@ -321,22 +322,26 @@ static int Main(string[] args)
|
321 | 322 | validationResult = LicenseeService.validate(context, demoLicenseeNumber, validationParameters);
|
322 | 323 | ConsoleWriter.WriteEntity("Validation result (APIKey):", validationResult);
|
323 | 324 |
|
324 |
| - // Validate using APIKey signed |
325 |
| - context.securityMode = SecurityMode.APIKEY_IDENTIFICATION; |
326 |
| - context.publicKey = publicKey; |
327 |
| - validationResult = LicenseeService.validate(context, demoLicenseeNumber, validationParameters); |
328 |
| - ConsoleWriter.WriteEntity("Validation result (APIKey / signed):", validationResult); |
329 |
| - |
330 |
| - // Validate using APIKey wrongly signed |
331 |
| - context.securityMode = SecurityMode.APIKEY_IDENTIFICATION; |
332 |
| - context.publicKey = publicKey_wrong; |
333 |
| - try |
| 325 | + // Verify signature on Linux or OSX only |
| 326 | + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) |
334 | 327 | {
|
| 328 | + // Validate using APIKey signed |
| 329 | + context.securityMode = SecurityMode.APIKEY_IDENTIFICATION; |
| 330 | + context.publicKey = publicKey; |
335 | 331 | validationResult = LicenseeService.validate(context, demoLicenseeNumber, validationParameters);
|
336 |
| - } |
337 |
| - catch (NetLicensingException e) |
338 |
| - { |
339 |
| - Console.WriteLine("Validation result exception (APIKey / wrongly signed): {0}", e); |
| 332 | + ConsoleWriter.WriteEntity("Validation result (APIKey / signed):", validationResult); |
| 333 | + |
| 334 | + // Validate using APIKey wrongly signed |
| 335 | + context.securityMode = SecurityMode.APIKEY_IDENTIFICATION; |
| 336 | + context.publicKey = publicKey_wrong; |
| 337 | + try |
| 338 | + { |
| 339 | + validationResult = LicenseeService.validate(context, demoLicenseeNumber, validationParameters); |
| 340 | + } |
| 341 | + catch (NetLicensingException e) |
| 342 | + { |
| 343 | + Console.WriteLine("Validation result exception (APIKey / wrongly signed): {0}", e); |
| 344 | + } |
340 | 345 | }
|
341 | 346 |
|
342 | 347 | // Reset context for futher use
|
|
0 commit comments