Exemplo n.º 1
0
		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;
		}
Exemplo n.º 2
0
        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>();
        }