Exemple #1
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;
        }