Пример #1
0
        /// <summary>
        ///     Encrypt Text to an Image with a custom encryption implementing <see cref="ICrypt" />
        /// </summary>
        /// <param name="key">The key used for the Encryption</param>
        /// <param name="unencryptedText">The original unencrypted Text</param>
        /// <param name="cryptScheme">The Scheme/Interface Used for Encryption</param>
        /// <param name="drawingScheme">The <see cref="DrawingScheme" /> to use for Drawing the Image</param>
        /// <param name="colorScheme">The <see cref="ColorScheme" /> to use for colorizing the Image</param>
        /// <returns>The Encrypted <see cref="Image" /></returns>
        public static Image Encrypt(
            string key,
            string unencryptedText,
            ICrypt cryptScheme,
            DrawingScheme drawingScheme = DrawingScheme.Line,
            ColorScheme colorScheme     = ColorScheme.RedMixed)
        {
            if (cryptScheme == null)
            {
                cryptScheme = new Cipher();
            }

            //Get the encrypted Text
            string encryptedText = cryptScheme.Encrypt(key, unencryptedText);

            //Get all ASCII values
            var asciiValues = Convert.FromBase64String(encryptedText);

            //Set correct Width and Height values
            Helper.SetWidthHeight(drawingScheme, out int height, out int width, asciiValues.Length);

            //Create Image with correct Sizes
            var encryptedImage = new Bitmap(width, height, PixelFormat.Format32bppArgb);

            //Draw onto the Image
            Helper.DrawCorrectScheme(encryptedImage, drawingScheme, colorScheme, asciiValues);

            return(encryptedImage);
        }
Пример #2
0
        private void DecryptBtn_Click(object sender, EventArgs e)
        {
            _watch.Reset();
            if (!File.Exists(FilePathTxt.Text))
            {
                MessageBox.Show(Resources.FileNotFoundMessage);
                return;
            }

            ChangeStates(false);
            StatusLbl.Text = Resources.DecryptionInProgressMessage;

            var filePath =
                Path.GetDirectoryName(FilePathTxt.Text) + $"\\decrypted-{DateTime.Now.Ticks}.{FileExtensionBx.Text}";

            Task.Run(() =>
            {
                _watch.Start();
                using (BinaryWriter bw = new BinaryWriter(File.Create(filePath)))
                    bw.Write(ICrypt.BmpDecrypt((Bitmap)Image.FromFile(FilePathTxt.Text)));
                _watch.Stop();
                Invoke(new MethodInvoker(() =>
                {
                    ChangeStates(true);
                    StatusLbl.Text = string.Format(Resources.DecryptionSuccessMessage, _watch.ElapsedMilliseconds);
                }));
            });
        }
Пример #3
0
            /// <summary>
            /// Decrypt a encrypted <see cref="Bitmap"/> to a <see cref="string"/>
            /// </summary>
            /// <param name="salt">The salt used for the Encryption</param>
            /// <param name="encryptedBitmap">The <see cref="BmpPwd"/> Encrypted <see cref="Bitmap"/></param>
            /// <param name="cryptScheme">The Scheme/Interface Used for Decryption</param>
            /// <param name="drawingScheme">The <see cref="DrawingScheme"/> to use for Drawing the Image</param>
            /// <returns>The decrypted Text from the Bitmap</returns>
            public static string Decrypt(
                string salt,
                Bitmap encryptedBitmap,
                ICrypt cryptScheme          = null,
                DrawingScheme drawingScheme = DrawingScheme.Line,
                ColorScheme colorScheme     = ColorScheme.RedMixed)
            {
                if (cryptScheme == null)
                {
                    cryptScheme = new Cipher();
                }

                //Set Width and Y for Image Reading
                int y = 0, width = 0;

                SetWidthY(drawingScheme, ref y, ref width, encryptedBitmap.Width);

                //Get all Colors from the Bitmap
                Color[] colors = GetPixelsFromBitmap(width, y, drawingScheme, colorScheme, encryptedBitmap);

                //Fill ASCII Values with Color's R Value (R = G = B)
                byte[] asciiValues = new byte[width];
                for (int i = 0; i < width; i++)
                {
                    asciiValues[i] = GetAsciiValue(colorScheme, colors[i]);
                }

                //Decrypt result
                string decrypted = Encoding.Unicode.GetString(asciiValues);

                decrypted = cryptScheme.Decrypt(salt, decrypted);

                return(decrypted);
            }
Пример #4
0
            /// <summary>
            /// Encrypt Text to a Bitmap with default Cipher Encryption
            /// </summary>
            /// <param name="salt">The salt used for the Encryption</param>
            /// <param name="unencryptedText">The original unencrypted Text</param>
            /// <param name="cryptScheme">The Scheme/Interface Used for Encryption</param>
            /// <param name="drawingScheme">The <see cref="DrawingScheme"/> to use for Drawing the Image</param>
            /// <returns>The Encrypted Bitmap</returns>
            public static Bitmap Encrypt(
                string salt,
                string unencryptedText,
                ICrypt cryptScheme          = null,
                DrawingScheme drawingScheme = DrawingScheme.Line,
                ColorScheme colorScheme     = ColorScheme.RedMixed)
            {
                if (cryptScheme == null)
                {
                    cryptScheme = new Cipher();
                }

                //Get the encrypted Text
                string encryptedText = cryptScheme.Encrypt(salt, unencryptedText);

                //Get all ASCII values
                byte[] asciiValues = Encoding.Unicode.GetBytes(encryptedText);

                //Set correct Width and Height values
                int width = 0, height = 0;

                SetWidthHeight(drawingScheme, ref height, ref width, asciiValues.Length);

                //Create Bitmap with correct Sizes
                Bitmap encryptedBitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);

                //Draw onto the Bitmap
                DrawCorrectScheme(encryptedBitmap, drawingScheme, colorScheme, asciiValues);

                return(encryptedBitmap);
            }
Пример #5
0
        private Program(DiadocApi diadocApi, ICrypt crypt)
        {
            consoleContext = new ConsoleContext
            {
                DiadocApi = diadocApi,
                Crypt     = crypt
            };

            consoleCommands = new List <IConsoleCommand>
            {
                new AuthenticateCommand(consoleContext),
                new LoginCommand(consoleContext),
                new ListCounteragentsCommand(consoleContext),
                new ActOnCounteragentCommand(consoleContext),
                new SelectBoxCommand(consoleContext),
                new ListEventsCommand(consoleContext),
                new GetEventCommand(consoleContext),
                new GetMessageCommand(consoleContext),
                new PostMessageCommand(consoleContext),
                new PrintCommand(consoleContext),
                new ConfigureProxyCommand(consoleContext),
                new GetProxyStatusCommand(consoleContext),
                new SearchCommand(consoleContext),
                new GetInvoicesCommand(consoleContext),
                new AttorneyCommand(consoleContext),
                new StatusCommand(consoleContext),
                new ExitCommand(consoleContext)
            };
        }
Пример #6
0
        // ------------------------------------------------------------------------------------------
        /// <summary> Funkcja wysyłająca wiadomość do określonego podłączonego. </summary>
        /// <param name="client"> Podłączony klient. </param>
        /// <param name="message"> Wiadomość wysyłana do klienta. </param>
        private void SendMessage(ClientData client, Message message)
        {
            Socket socket = client.Socket;

            //  Szyfrowanie wiadomości do wsyłania
            if (client.Encrypted)
            {
                ICrypt encryptionServices = null;
                switch (client.CryptType)
                {
                case CryptType.RSA:
                    encryptionServices = encryptionServicesRSA;
                    break;

                case CryptType.ElGamal:
                    encryptionServices = encryptionServicesElGamal;
                    break;
                }
                message.Encrypt(encryptionServices, client.Key);
            }

            byte[] buffer = Encoding.ASCII.GetBytes(message.ToString());
            Console.Write(message.ToString());
            AsyncCallback sender = new AsyncCallback(SendCallback);

            socket.BeginSend(buffer, 0, buffer.Length, SocketFlags.None, sender, client);
            client.BeginReciveMessages();
        }
 internal SpecifyClientIdentification(IHttpClientConfiguration clientConfiguration, ICrypt cryptoProvider, RequestTimeouts?options, ILog log)
 {
     ClientConfiguration = clientConfiguration ?? throw new ArgumentNullException(nameof(clientConfiguration));
     CryptoProvider      = cryptoProvider;
     RequestTimeouts     = options;
     Log = log;
 }
Пример #8
0
        static void CryptoFile(ICrypt _cryptFiles)
        {
            Console.Write("Please enter full name directory with files: ");
            string directory_name = Console.ReadLine();

            Console.Write("Please enter password: "******"1. Encrypt file");
            Console.WriteLine("2. Decrypt file");

            char e = Console.ReadKey().KeyChar;

            switch (e)
            {
            case (char)49:
                //Console.WriteLine($"Start encrypt file: {file_name}");
                Console.WriteLine($"Start encrypt");
                _cryptFiles.EncryptAsync(PasswordToByte(password), GetFiles(@directory_name));
                //Console.WriteLine($"File - {file_name}, encrypted!");
                break;

            case (char)50:
                //Console.WriteLine($"Start decrypt file: {file_name}");
                _cryptFiles.DecryptAsync(PasswordToByte(password), GetFiles(@directory_name));
                break;
            }
            Console.WriteLine("----");
            Console.ReadKey();
        }
Пример #9
0
        public static async ValueTask <DraftsBuilderFileRequest> CreateRequestAsync(
            Guid accountId,
            string fileName,
            DraftsBuilderDocumentFileData?builderData,
            IDocumentContentUploadStrategy?contentUploadStrategy,
            IContentService uploader,
            ICrypt crypt,
            TimeSpan?uploadTimeout)
        {
            if (string.IsNullOrWhiteSpace(fileName))
            {
                throw Errors.StringShouldNotBeNullOrWhiteSpace(nameof(fileName));
            }

            Guid?     contentId = null;
            Signature?signature = null;

            if (contentUploadStrategy is not null)
            {
                (contentId, signature) = await contentUploadStrategy.UploadAndSignAsync(accountId, uploader, crypt, uploadTimeout).ConfigureAwait(false);
            }

            return(new DraftsBuilderFileRequest(
                       contentId,
                       signature?.ToBase64String().ToString(),
                       new DraftsBuilderFileMetaRequest(fileName, builderData)
                       ));
        }
Пример #10
0
        /// <summary>
        ///     Decrypt a encrypted <see cref="Image" /> to a <see cref="string" />
        /// </summary>
        /// <param name="key">The key used for the Encryption</param>
        /// <param name="encryptedImage">The <see cref="BmpPwd" /> Encrypted <see cref="Image" /></param>
        /// <param name="cryptScheme">The Scheme/Interface Used for Decryption</param>
        /// <param name="drawingScheme">The <see cref="DrawingScheme" /> to use for Drawing the Image</param>
        /// <param name="colorScheme">The <see cref="ColorScheme" /> to use for colorizing the Image</param>
        /// <returns>The decrypted Text from the Image</returns>
        public static string Decrypt(
            string key,
            Image encryptedImage,
            ICrypt cryptScheme,
            DrawingScheme drawingScheme = DrawingScheme.Line,
            ColorScheme colorScheme     = ColorScheme.RedMixed)
        {
            if (cryptScheme == null)
            {
                cryptScheme = new Cipher();
            }

            //Set Width and Y for Image Reading
            Helper.SetWidthY(drawingScheme, out int y, out int width, encryptedImage.Width);

            //Get all Colors from the Image
            var colors = Helper.GetPixelsFromImage(width, y, drawingScheme, colorScheme, encryptedImage);

            //Fill ASCII Values with Color's R Value (R = G = B)
            var asciiValues = new byte[width];

            for (int i = 0; i < width; i++)
            {
                asciiValues[i] = Helper.GetAsciiValue(colorScheme, colors[i]);
            }

            // Decrypt result
            string base64 = Convert.ToBase64String(asciiValues);

            return(cryptScheme.Decrypt(key, base64));
        }
Пример #11
0
        private void decrypterButton_Click(object sender, EventArgs e)
        {
            if (!IsReady())
            {
                return;
            }

            if (_inputDir != null && _outputDir != null)
            {
                Metadata met = new Metadata(_inputDir, _outputDir, State.Decode, _keepInvalidChar, _codeAndTranslate,
                                            _type, _cesarKey);

                ICrypt crypt = (_algorithm == TypeC.Aero) ? new Aero(met, _aeroUseInt)
                    : (_algorithm == TypeC.Cesar) ? new Cesar(met, _cesarLeftToRight)
                    : (_algorithm == TypeC.Morse) ? new Morse(met)
                    : (_algorithm == TypeC.Navajo) ? new Navajo(met)
                    : (_algorithm == TypeC.Vigenere) ? new Vigenere(met, _vigenereKey)
                    : new Binaire(met);

                crypt.Translate();
                crypt.WriteResult();
            }
            else
            {
                string message = "Erreur: paramètre inexistant, veuillez entrer une valeur.";
                string source  = (_inputDir is null) ? nameof(_inputDir) : nameof(_outputDir);
                string details = $"Error in Decrypt method: {source} should not be null";
                Error  err     = new Error(message, source, details);
                Error = err;
            }

            CryptoStatusCheck(State.Decode);
        }
Пример #12
0
 // ##########################################################################################
 /// <summary> Funkcja szyfrująca wewnętrznie wiadomość. </summary>
 /// <param name="crypt"> Klasa szyfrująca. </param>
 /// <param name="publicKey"> Klucz publiczny. </param>
 public void Encrypt(ICrypt crypt, string publicKey)
 {
     if (crypt == null)
     {
         return;
     }
     this.message = crypt.Encrypt(this.message, publicKey);
 }
        public async Task <Signature> SignAsync(CertificateContent certificate, ICrypt crypt)
        {
            stream.Position = 0;
            var bytes = new byte[stream.Length];
            await stream.ReadAsync(bytes, 0, bytes.Length).ConfigureAwait(false);

            return(crypt.Sign(bytes, certificate.ToBytes()));
        }
Пример #14
0
        private static void DemoCryptAlgorithm(ICrypt algorithm, string message)
        {
            var encryptMessage   = algorithm.Crypt(message);
            var decryptedMessage = algorithm.Decrypt(encryptMessage);

            Console.WriteLine(encryptMessage);
            Console.WriteLine(decryptedMessage);
            Console.WriteLine();
        }
Пример #15
0
        public ConnectionBase(string communicationKey, NoWCFSettings settings)
        {
            _setings          = settings;
            _communicationKey = communicationKey;

            if (_setings.UseEncryption)
            {
                _cryptor = _setings.CryptorFactory().Initialize(communicationKey);
            }
        }
Пример #16
0
        public NoWCFSettings InitializeEncryption()
        {
            if (BasicCommunicationEncryptionKey != null)
            {
                GenericCryptor = CryptorFactory().Initialize(BasicCommunicationEncryptionKey);
            }

            initializeCertificate();

            return(this);
        }
Пример #17
0
        public static ICrypt GetCrypt(string storageName, EncryptionSettings encryptionSettings)
        {
            ICrypt result = null;

            if (Builder != null)
            {
                result = ResolutionExtensions.ResolveOptional <ICrypt>(Builder, new TypedParameter(typeof(string), storageName), new TypedParameter(typeof(EncryptionSettings), encryptionSettings));
            }

            return(result ?? new FakeCrypt(storageName, encryptionSettings));
        }
Пример #18
0
 // ------------------------------------------------------------------------------------------
 /// <summary> Funkcja deszyfrująca wewnętrznie wiadomość. </summary>
 /// <param name="crypt"> Klasa szyfrująca. </param>
 /// <param name="decrypt"> Informacja czy wiadomość jest zaszyfrowana. </param>
 public void Decrypt(ICrypt crypt, bool decrypt)
 {
     if (crypt == null)
     {
         return;
     }
     if (decrypt)
     {
         this.message = crypt.Decrypt(this.message);
     }
 }
Пример #19
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <string> s = new List <string> {
                "a", "b"
            };
            var image = ICrypt.ImageFromObject(s);

            image.Save("lmao.png");
            var newList = ICrypt.ImageToObject <List <string> >((Bitmap)Image.FromFile("lmao.png"));

            MessageBox.Show(newList[1]);
        }
Пример #20
0
        public DocumentContentToUpload_Tests()
        {
            accountId = Guid.NewGuid();
            uploader  = Substitute.For <IContentService>();

            expectedContentId = Guid.NewGuid();
            documentContent   = Substitute.For <IDocumentContent>();
            documentContent.UploadAsync(uploader, accountId, Arg.Any <TimeSpan?>())
            .Returns(expectedContentId);

            crypt = Substitute.For <ICrypt>();
        }
Пример #21
0
        public SpeedTest()
        {
            CommonMethods = new CommonMethods();

            Settings = new EncryptionSettings()
            {
                Password    = EncryptionSettings.GeneratePassword(32, 16),
                Status      = EncryprtionStatus.Encrypted,
                NotifyUsers = false
            };

            Crypt = new Crypt("test", Settings);
        }
Пример #22
0
        public ICrypt GetCrypt(string storageName, EncryptionSettings encryptionSettings)
        {
            ICrypt result = null;

            using var scope = Container.BeginLifetimeScope();
            if (scope != null)
            {
                result = scope.Resolve <ICrypt>();
            }

            result ??= new FakeCrypt();
            result.Init(storageName, encryptionSettings);
            return(result);
        }
Пример #23
0
        public ICrypt GetCrypt(string storageName, EncryptionSettings encryptionSettings)
        {
            ICrypt result = null;

            using var scope = ServiceProvider.CreateScope();
            if (scope != null)
            {
                result = scope.ServiceProvider.GetService <ICrypt>();
            }

            result ??= new FakeCrypt();
            result.Init(storageName, encryptionSettings);
            return(result);
        }
Пример #24
0
 public ExternClientServices(
     ContentManagementOptions contentManagementOptions,
     IHttpRequestFactory http,
     IJsonSerializer jsonSerializer,
     IExternHttpClient api,
     IPollingStrategy longOperationsPollingStrategy,
     IAuthenticator authenticator,
     ICrypt crypt)
 {
     Http           = http ?? throw new ArgumentNullException(nameof(http));
     JsonSerializer = jsonSerializer ?? throw new ArgumentNullException(nameof(jsonSerializer));
     Api            = api ?? throw new ArgumentNullException(nameof(api));
     LongOperationsPollingStrategy = longOperationsPollingStrategy ?? throw new ArgumentNullException(nameof(longOperationsPollingStrategy));
     Authenticator  = authenticator ?? throw new ArgumentNullException(nameof(authenticator));
     Crypt          = crypt ?? throw new ArgumentNullException(nameof(crypt));
     ContentService = new ContentService(api.Contents, contentManagementOptions);
 }
Пример #25
0
        // ##########################################################################################
        /// <summary> Konstruktor obiektu klasy Client. </summary>
        /// <param name="username"> Rozpoznawalna nazwa użytkownika. </param>
        /// <param name="ip"> Adres protokołu internetowego serwera. </param>
        /// <param name="port"> Port protokołu sieciowego serwera. </param>
        /// <param name="ctype"> Rodzaj szyfrowania wiadomości. </param>
        public Client(string username, string ip, int port, CryptType ctype = 0)
        {
            this.Username  = username;
            this.ServerIP  = ip;
            this.Port      = port;
            this.cryptType = ctype;

            switch (this.cryptType)
            {
            case CryptType.RSA:
                this.encryptionServices = new ERSA();
                break;

            case CryptType.ElGamal:
                this.encryptionServices = new ElGamal();
                break;
            }
        }
Пример #26
0
        /// <summary>
        /// Stellt eine Verbindung zwischen zwei Endpunkten dar. In diesem Fall zwischen L2Server und L2Client
        /// </summary>
        /// <param name="connection">Der TcpClient der die Verbindung hält</param>
        /// <param name="cryptor">Der Cryptor der für ent-/verschlüsslung zuständig ist</param>
        public Connection(TcpClient connection, ICrypt cryptor)
        {
            this.connection       = connection;
            this.connectionReader = new BinaryReader(this.connection.GetStream());
            this.connectionWriter = new BinaryWriter(this.connection.GetStream());

            this.cryptor = cryptor;

            // start the Threads
            this.running = true;

            this.readThread = new Thread(readThreadWorker);
            this.readThread.IsBackground = true;
            this.readThread.Start();

            this.sendThread = new Thread(sendThreadWorker);
            this.sendThread.IsBackground = true;
            this.sendThread.Start();
        }
Пример #27
0
        /// <summary>
        /// Stellt eine Verbindung zwischen zwei Endpunkten dar. In diesem Fall zwischen L2Server und L2Client
        /// </summary>
        /// <param name="connection">Der TcpClient der die Verbindung hält</param>
        /// <param name="cryptor">Der Cryptor der für ent-/verschlüsslung zuständig ist</param>
        public Connection(TcpClient connection, ICrypt cryptor)
        {
            this.connection = connection;
            this.connectionReader = new BinaryReader(this.connection.GetStream());
            this.connectionWriter = new BinaryWriter(this.connection.GetStream());

            this.cryptor = cryptor;

            // start the Threads
            this.running = true;

            this.readThread = new Thread(readThreadWorker);
            this.readThread.IsBackground = true;
            this.readThread.Start();

            this.sendThread = new Thread(sendThreadWorker);
            this.sendThread.IsBackground = true;
            this.sendThread.Start();
        }
Пример #28
0
 public DiadocHttpApi([NotNull] string apiClientId, [NotNull] IHttpClient httpClient, [NotNull] ICrypt crypt, [NotNull] IHttpSerializer httpSerializer)
 {
     if (apiClientId == null)
     {
         throw new ArgumentNullException("apiClientId");
     }
     if (httpClient == null)
     {
         throw new ArgumentNullException("httpClient");
     }
     if (crypt == null)
     {
         throw new ArgumentNullException("crypt");
     }
     this.apiClientId    = apiClientId;
     HttpClient          = httpClient;
     this.crypt          = crypt;
     this.httpSerializer = httpSerializer;
 }
Пример #29
0
        public string ReadJson(string path, ICrypt crypt = null, IRoles role = null)
        {
            if (System.IO.Path.GetExtension(path).ToLower() != ".json")
            {
                throw new Exception("Wrong file type.");
            }
            if (role != null)
            {
                role.check(path);
            }

            if (crypt == null)
            {
                return(System.IO.File.ReadAllText(path));
            }
            else
            {
                return(crypt.Decode(System.IO.File.ReadAllText(path)));
            }
        }
Пример #30
0
        public Client(Shared.ClientSettings settings)
        {
            ReadyToUse        = false;
            AuthType          = settings.userType;
            Username          = settings.userName;
            Password          = settings.password;
            proxy             = InitProxy(settings.proxyUrl, settings.proxyPort, settings.proxyUser, settings.proxyPass);
            PokemonHttpClient = new PokemonHttpClient();
            Login             = new Rpc.Login(this);
            Player            = new Rpc.Player(this);
            Download          = new Rpc.Download(this);
            Inventory         = new Rpc.Inventory(this);
            Map       = new Rpc.Map(this);
            Fort      = new Rpc.Fort(this);
            Encounter = new Rpc.Encounter(this);
            Misc      = new Rpc.Misc(this);
            Crypter   = new Cipher();
            Hasher    = new PokeHashHasher(settings.hashKey);
            Store     = new PokemonGo.RocketAPI.Rpc.Store(this);

            if (DeviceSetup.SelectedDevice.OSType == "iOS")
            {
                Platform = POGOProtos.Enums.Platform.Ios;
            }
            else
            {
                Platform = POGOProtos.Enums.Platform.Android;
            }

            Logger.Info("Platform:" + Platform);


            InventoryLastUpdateTimestamp = 0;

            AppVersion   = Resources.Api.AndroidClientVersionInt;
            SettingsHash = "";

            CurrentApiEmulationVersion = settings.currentApi;
        }
Пример #31
0
        public DiscDataStore(string tenant, HandlerConfigurationElement handlerConfig, ModuleConfigurationElement moduleConfig)
        {
            _tenant = tenant;
            //Fill map path
            _modulename = moduleConfig.Name;
            _dataList   = new DataList(moduleConfig);
            foreach (DomainConfigurationElement domain in moduleConfig.Domains)
            {
                _mappedPaths.Add(domain.Name, new MappedPath(tenant, moduleConfig.AppendTenant, domain.Path, handlerConfig.GetProperties()));
            }
            //Add default
            _mappedPaths.Add(string.Empty, new MappedPath(tenant, moduleConfig.AppendTenant, PathUtils.Normalize(moduleConfig.Path), handlerConfig.GetProperties()));

            //Make expires
            _domainsExpires =
                moduleConfig.Domains.Cast <DomainConfigurationElement>().Where(x => x.Expires != TimeSpan.Zero).
                ToDictionary(x => x.Name,
                             y => y.Expires);
            _domainsExpires.Add(string.Empty, moduleConfig.Expires);

            var settings = moduleConfig.DisabledEncryption ? new EncryptionSettings() : EncryptionSettings.Load();

            crypt = EncryptionFactory.GetCrypt(moduleConfig.Name, settings);
        }