Esempio n. 1
0
        AESservice getAESsettings()
        {
            string salt = Setting.salt;
            string initializationVector = Setting.aesIv;

            AESservice aesService = new AESservice(salt, initializationVector);

            return(aesService);
        }
Esempio n. 2
0
        static string encrypt(string input)
        {
            string key = Setting.userPassword;

            AESservice  aes         = new AESservice(xSalt, xAesIv);
            CryptObject cryptObject = aes.encrypt(input, key);
            string      output      = cryptObject.value;

            return(output);
        }
Esempio n. 3
0
        static string decrypt(string input)
        {
            string output = null;
            string key    = Setting.userPassword;

            AESservice  aes         = new AESservice(xSalt, xAesIv);
            CryptObject cryptObject = aes.decrypt(input, key);

            if (cryptObject.operationSuccess)
            {
                output = cryptObject.value;
            }
            else
            {
                output = null;
            }

            return(output);
        }
Esempio n. 4
0
        void decrypt()
        {
            string ciphertext = getInput(textBox1);
            string password   = getInput(textBox2);

            AESservice aesService = getAESsettings();

            CryptObject cryptObject = aesService.decrypt(ciphertext, password);
            string      output      = cryptObject.value;

            if (cryptObject.operationSuccess)
            {
                printOutput(output);
            }
            else
            {
                MessageBox.Show(output, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }