Esempio n. 1
0
        private async void EncryptFileToBase64String_Clicked(object sender, EventArgs e)
        {
            FileData file = await CrossFilePicker.Current.PickFile();

            if (file != null)
            {
                await Navigation.PushModalAsync(popup);

                await Task.Delay(5000);

                StringBuilder stb        = new StringBuilder(file.FilePath);
                int           postIndex  = IndexOf(stb, file.FileName, 0, true);
                string        folderPath = stb.Remove(postIndex, file.FilePath.Length - postIndex).ToString();

                //convert android content Uri into physical path, normally happens in Android emulator
                folderPath = ConvertAndroidContentUriPath(folderPath);

                string encryptedStr = await XamEncDec.EncryptFileAsBase64String(false, false, folderPath, "", file.FileName, "myPassword");

                //edt_encfiletostr.Text = encryptedStr;
                file.Dispose();
                Output outp = new Output();
                outp.OutputStr = encryptedStr;
                var OutputPage = new OutputText();
                OutputPage.BindingContext = outp;
                await Navigation.PushAsync(OutputPage);

                await Navigation.PopModalAsync();
            }
        }
Esempio n. 2
0
        public async void EncryptFileToBase64String()
        {
            //eg. encrypt a file and generate encrypted base64 string

            //XamEncDec.EncryptFileAsBase64String(<true/false to delete source file>,
            //<True=local directory,False=use custom path>, <set string for custom path>,
            //<new/existing folder name>, <file name to be encrypted>, <password for encryption>);
            var encryptedString = await XamEncDec.EncryptFileAsBase64String(false, true, "", "folderName2", "MARBLES.JPG", "myPassword");
        }