private async void DecryptButton_Click(object sender, RoutedEventArgs e)
 {
     if (isAES && aes != null)
     {
         ResultTextBlock.Text = CryptographyHelper.DecryptAes(
             await FilesHelper.GetByteArrayAsync(_encryptedTextAes), aes);
     }
     else if (!isAES && rsa != null)
     {
         ResultTextBlock.Text = CryptographyHelper.DecryptRSA(
             await FilesHelper.GetByteArrayAsync(_encryptedTextRsa), rsa.ExportParameters(true), false);
     }
 }
        private async void MessageDigestButton_Click(object sender, RoutedEventArgs e)
        {
            if (FilesHelper.DataFolder == null)
            {
                ShowMessageDialog();
                return;
            }

            String       hash     = CryptographyHelper.Sha256Hash(fileContent);
            IStorageFile hashFile = await FilesHelper.GetFile(_messageDigest);

            await FileIO.WriteTextAsync(hashFile, hash);

            ResultTextBlock.Text = hash;
        }
        private async void SignButton_Click(object sender, RoutedEventArgs e)
        {
            if (FilesHelper.DataFolder == null)
            {
                ShowMessageDialog();
                return;
            }

            String signedText = CryptographyHelper.CreateSignature(fileContent);

            IStorageFile signedFile = await FilesHelper.GetFile(_signature);

            await FileIO.WriteTextAsync(signedFile, signedText);

            ResultTextBlock.Text = signedText;
        }
        private async void EncryptButton_Click(object sender, RoutedEventArgs e)
        {
            if (FilesHelper.DataFolder == null)
            {
                ShowMessageDialog();
                return;
            }
            IStorageFile encryptedFile;

            if (isAES)
            {
                aes = Aes.Create();
                IStorageFile secretKeyFile = await FilesHelper.GetFile(_secretKey);

                await FileIO.WriteBytesAsync(file : secretKeyFile, buffer : aes.Key);

                encryptedFile = await FilesHelper.GetFile(_encryptedTextAes);

                encryptedByteArrayAes = CryptographyHelper.EncryptAes(fileContent, aes);
                await FileIO.WriteBytesAsync(file : encryptedFile, buffer : encryptedByteArrayAes);

                ResultTextBlock.Text = await FileIO.ReadTextAsync(encryptedFile,
                                                                  Windows.Storage.Streams.UnicodeEncoding.Utf16BE);
            }
            else
            {
                rsa = RSA.Create();
                await CreateRsaKeys();

                encryptedFile = await FilesHelper.GetFile(_encryptedTextRsa);

                encryptedByteArrayRsa = CryptographyHelper.EncryptRSA(
                    await FilesHelper.GetByteArrayAsync(_initialText), rsa.ExportParameters(false));

                await FileIO.WriteBytesAsync(file : encryptedFile, buffer : encryptedByteArrayRsa);

                ResultTextBlock.Text = await FileIO.ReadTextAsync(encryptedFile,
                                                                  UnicodeEncoding.Utf16BE);
            }
        }
        private async void CheckSignatureButton_Click(object sender, RoutedEventArgs e)
        {
            if (FilesHelper.DataFolder == null)
            {
                ShowMessageDialog();
                return;
            }

            String inputFileText = await FileIO.ReadTextAsync(inputFile);

            IStorageFile signatureFile = await FilesHelper.GetFile(_signature);

            String signature = await FileIO.ReadTextAsync(signatureFile);

            if (CryptographyHelper.VerifySignature(inputFileText, signature))
            {
                ResultTextBlock.Text = "Potpis je ispravan";
            }
            else
            {
                ResultTextBlock.Text = "Potpis nije ispravan";
            }
        }