コード例 #1
0
        static string TestKeyText(string key, string text)
        {
            var ps     = new PontifexSolitaire(key);
            var output = ps.Encrypt(text).Pad5();

            return(output);
        }
コード例 #2
0
        public async void DecryptClicked(object sender, EventArgs e)
        {
            if (!ValidInputs())
            {
                await DisplayAlert("Missing input", "You must enter plaintext/ciphertext and the key", "OK");

                return;
            }
            var ps = new PontifexSolitaire(key.Text);

            ciphertext.Text = ps.Decrypt(plaintext.Text).Pad5();

            Tweet.Code = ciphertext.Text;
        }
コード例 #3
0
        public async void DecryptClicked(object sender, EventArgs e)
        {
            if (!ValidInputs())
            {
                await DisplayAlert("Missing input", "You must enter plaintext/ciphertext and the key", "OK");

                return;
            }
            var ps = new PontifexSolitaire(key.Text);

            ciphertext.Text = ps.Decrypt(plaintext.Text).Pad5();

            // was for contest (now closed) http://blog.xamarin.com/xamarin-acquires-petzold/
            //Tweet.Code = ciphertext.Text;
        }
コード例 #4
0
        public QRMakerPage()
        {
            this.InitializeComponent();
            this.BindingContext = QRMakerPageViewModel.BindingContext;

            Login data = JsonConvert.DeserializeObject <Login>(Settings.GeneralSettings);
            Login qr   = new Login
            {
                Id      = data.Id,
                Name    = data.Name,
                Number  = data.Number,
                Tickets = data.Tickets,
            };

            qrData = JsonConvert.SerializeObject(qr);

            var ps = new PontifexSolitaire("patitofeo");

            qrDataCrypt = ps.Encrypt(data.Id).Pad5();
        }
コード例 #5
0
        public void scanView_OnScanResult(Result result)
        {
            Device.BeginInvokeOnMainThread(async() =>
            {
                var ps  = new PontifexSolitaire("patitofeo");
                var Ras = ps.Decrypt(result.Text).Pad5();
                //await DisplayAlert("Resultado", "The barcode's text is " + Ras, "OK");
                var user = await fireBaseHelper.GetById(Ras);

                if (user != null && user.Tickets >= 1)
                {
                    var sumTickets = user.Tickets - 1;
                    await fireBaseHelper.AddTicket(user.Id, user.Name, user.Number, user.Password, user.Rol, sumTickets);
                    //await DisplayAlert("Exito", "El tiquete ha sido cobrado ", "OK");
                    //Application.Current.MainPage = new AdminPage();
                    await Navigation.PushModalAsync(new AdminPage());
                }
                else
                {
                    await DisplayAlert("Error", "El usuario no existe o el codigo esta corrupto o no tiene tiquetes disponibles", "OK");
                    await Navigation.PushModalAsync(new AdminPage());
                }
            });
        }