Exemple #1
0
        private async void EncryptResFileToBase64String_Clicked(object sender, EventArgs e)
        {
            if (p_resfile1.SelectedIndex == -1)
            {
                await DisplayAlert("Error", "Please select resource file", "OK");
            }
            else
            {
                await Navigation.PushModalAsync(popup);

                await Task.Delay(5000);

                string encryptedStr = await XamEncDec.EncryptResourceFileAsBase64String(assembly, GetResourceValue(p_resfile1.SelectedIndex), "myPassword");

                if (encryptedStr != "")
                {
                    //edt_encrestostr.Text = encryptedStr;
                    Output outp = new Output();
                    outp.OutputStr = encryptedStr;
                    var OutputPage = new OutputText();
                    OutputPage.BindingContext = outp;
                    await Navigation.PushAsync(OutputPage);
                }
                else
                {
                    await DisplayAlert("Error", "Resource file failed to encrypted", "OK");
                }
                await Navigation.PopModalAsync();
            }
        }
Exemple #2
0
        public async void EncryptResourceFileToBase64String(Assembly assembly, string resourceName, string password)
        {
            //eg. encrypt resource file and generate encrypted Base64 string

            //XamEncDec.EncryptResourceFileAsBase64String(<Assembly object>,
            //<Resource filename>, <password>);
            var encryptedString = await XamEncDec.EncryptResourceFileAsBase64String(assembly, "TestFileEncryptDecryptXamarin.Files.MARBLES.JPG", "myPassword");
        }