コード例 #1
0
ファイル: ServicesService.cs プロジェクト: staxmanade/Scutex
        public bool AddLicenseKeysToService(LicenseSet licenseSet, Service service, List<string> keys)
        {
            string mgmtToken = _packingService.PackToken(service.GetManagementToken());

            AddLicenseKeysForProductData data = new AddLicenseKeysForProductData();
            data.LicenseSetId = licenseSet.LicenseSetId;
            data.Keys = keys;

            AddLicenseKeysForProductResult result = _productsProvider.AddLicenseKeysForLicenseSet(service.ManagementUrl, mgmtToken,
                                                                                                                         GetManagementStandardEncryptionInfo(service),
                                                                                                                         service.GetManagementServiceKeyPair(), data);

            if (IsResultValid(result))
                return true;

            return false;
        }
コード例 #2
0
		public AddLicenseKeysForProductResult AddLicenseKeysForLicenseSet(string url, string token,
			EncryptionInfo encryptionInfo, KeyPair serviceKeys, AddLicenseKeysForProductData 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.AddLicenseKeysForProduct(encryptedToken, encryptedData);
			string decryptedResult = _asymmetricEncryptionProvider.DecryptPublic(encryptedResult, serviceKeys);

			AddLicenseKeysForProductResult result = _objectSerializationProvider.Deserialize<AddLicenseKeysForProductResult>(decryptedResult);

			return result;
		}