public string GetLicenseKeysForProduct(string token, string data) { GetLicenseKeysForProductResult result = new GetLicenseKeysForProductResult(); try { if (!_controlService.ValidateManagementToken(token)) { result.WasOperationSuccessful = false; return(_controlService.EncryptSymmetricResponse(_serializationProvider.Serialize(result))); } result.WasRequestValid = true; GetLicenseKeysForProductData productData = _controlService.DeserializeAndDencryptMgmtInboundData <GetLicenseKeysForProductData>(data); result.LicenseKeys = _keyManagementService.GetKeysForLicenseSet(productData.LicenseSetId); Debug.WriteLine(result.LicenseKeys.Count); result.WasOperationSuccessful = true; } catch (Exception ex) { result.WasException = true; result.ExceptionMessage = ex.Message; } return(_controlService.SerializeAndEncryptMgmtOutboundData(result)); }
public List <string> GetServiceLicenseKeysForSet(LicenseSet licenseSet, Service service) { string mgmtToken = _packingService.PackToken(service.GetManagementToken()); GetLicenseKeysForProductData data = new GetLicenseKeysForProductData(); data.LicenseSetId = licenseSet.LicenseSetId; GetLicenseKeysForProductResult result = _productsProvider.GetLicenseKeysForLicenseSet(service.ManagementUrl, mgmtToken, GetManagementStandardEncryptionInfo(service), service.GetManagementServiceKeyPair(), data); if (IsResultValid(result)) { return(result.LicenseKeys); } return(new List <string>()); }
public GetLicenseKeysForProductResult GetLicenseKeysForLicenseSet(string url, string token, EncryptionInfo encryptionInfo, KeyPair serviceKeys, GetLicenseKeysForProductData data) { ProductsServiceClient client = ProductClientCreator(url); string encryptedToken = _symmetricEncryptionProvider.Encrypt(token, encryptionInfo); string serializedPayload = _objectSerializationProvider.Serialize(data); string encryptedData = _asymmetricEncryptionProvider.EncryptPrivate(serializedPayload, serviceKeys); string encryptedResult = client.GetLicenseKeysForProduct(encryptedToken, encryptedData); string decryptedResult = _asymmetricEncryptionProvider.DecryptPublic(encryptedResult, serviceKeys); GetLicenseKeysForProductResult result = _objectSerializationProvider.Deserialize <GetLicenseKeysForProductResult>(decryptedResult); return(result); }