public InitializationResult InitializeService(string url, string token, MasterServiceData data, EncryptionInfo encryptionInfo)
        {
            StatusServiceClient client = StatusServiceClientCreator(url);

            string encryptedToken = _symmetricEncryptionProvider.Encrypt(token, encryptionInfo);
            string serializedData = _objectSerializationProvider.Serialize(data);
            string encryptedData = _symmetricEncryptionProvider.Encrypt(serializedData, encryptionInfo);

            string result = client.InitializeService(encryptedToken, encryptedData);
            string decryptedResult = _symmetricEncryptionProvider.Decrypt(result, encryptionInfo);

            InitializationResult initializationResult = _objectSerializationProvider.Deserialize<InitializationResult>(decryptedResult);
            return initializationResult;
        }
Example #2
0
		public MasterServiceData SetMasterServiceData(MasterServiceData data)
		{
			if (GetMasterServiceData() != null)
				return null;

			using (ScutexServiceEntities db1 = new ScutexServiceEntities())
			{
				Master m = new Master();
				m.ServiceId = data.ServiceId;
				m.ClientInboundKey = data.ClientInboundKey;
				m.ClientOutboundKey = data.ClientOutboundKey;
				m.ManagementInboundKey = data.ManagementInboundKey;
				m.ManagementOutboundKey = data.ManagementOutboundKey;
				m.Token = data.Token;

				db1.AddToMasters(m);
				db1.SaveChanges();
			}

			return GetMasterServiceData();
		}
Example #3
0
		public MasterServiceData SetMasterServiceData(MasterServiceData data)
		{
			return _commonRepository.SetMasterServiceData(data);
		}
Example #4
0
        public bool InitializeService(Service service)
        {
            string token = _packingService.PackToken(service.GetManagementToken());
            StatusRequestResult statusResult = _serviceStatusProvider.GetServiceStatus(service.ManagementUrl, token, GetManagementStandardEncryptionInfo(service));

            if (statusResult.IsInitialized == true)
                return false;

            if (statusResult.IsActive == true)
                return false;

            if (statusResult.IsRequestValid == false)
                return false;

            MasterServiceData masterData = new MasterServiceData();
            masterData.ServiceId = service.UniquePad;
            masterData.Token = service.Token;
            masterData.Initialized = true;
            masterData.ClientInboundKey = service.GetClientInboundKeyPart1();
            masterData.ClientOutboundKey = service.GetClientOutboundKeyPart1();
            masterData.ManagementInboundKey = service.GetManagementInboundKeyPart1();
            masterData.ManagementOutboundKey = service.GetManagementOutboundKeyPart1();

            InitializationResult result = _serviceStatusProvider.InitializeService(service.ManagementUrl, token, masterData,
                                                                                             GetManagementStandardEncryptionInfo(service));

            if (!result.WasInitializionSucessful)
                return false;

            return true;
        }