Exemple #1
0
        private static byte[] Create(KeyProviderQueryContext ctx)
        {
            IOConnectionInfo iocPrev = GetAuxFileIoc(ctx);

            Info Info = Info.Load(iocPrev);

            if (Info == null)
            {
                Info = new Info();
            }

            CreateFingerPrint cfp = new CreateFingerPrint();

            UIUtil.ShowDialogAndDestroy(cfp);

            if (cfp.Access() != true)
            {
                return(null);
            }

            Creation dlge = new Creation();

            dlge.InitEx(Info, ctx);

            UIUtil.ShowDialogAndDestroy(dlge);
            if (!CreateAuxFile(Info, ctx))
            {
                return(null);
            }
            SampleKeyProvider sm = new SampleKeyProvider();

            return(Info.Secret);
            //return Encoding.UTF8.GetBytes(sm.DeCode(Info.Secret.ToString()));
        }
Exemple #2
0
        private static byte[] Open(KeyProviderQueryContext ctx)
        {
            IOConnectionInfo ioc = GetAuxFileIoc(ctx);

            Info Info = Info.Load(ioc);

            if (Info == null)
            {
                MessageService.ShowWarning("Failed to load auxiliary OTP info file:",
                                           ioc.GetDisplayName());

                Info = new Info();

                Login dlgRec = new Login();
                dlgRec.InitEx(Info, ctx);
                if (UIUtil.ShowDialogAndDestroy(dlgRec) != DialogResult.OK)
                {
                    return(null);
                }

                return(Info.Secret);
            }

            Login dlg = new Login();

            UIUtil.ShowDialogAndDestroy(dlg);

            if (System.Text.Encoding.UTF8.GetString(dlg.Access()) != System.Text.Encoding.UTF8.GetString(Info.Secret))
            {
                return(null);
            }



            if (!CreateAuxFile(Info, ctx))
            {
                return(null);
            }

            return(Info.Secret);
        }
Exemple #3
0
        private static byte[] Create(KeyProviderQueryContext ctx)
        {
            IOConnectionInfo iocPrev = GetAuxFileIoc(ctx);
            Info             Info    = Info.Load(iocPrev);

            if (Info == null)
            {
                Info = new Info();
            }
            Creation dlg = new Creation();

            dlg.InitEx(Info, ctx);

            UIUtil.ShowDialogAndDestroy(dlg);


            if (!CreateAuxFile(Info, ctx))
            {
                return(null);
            }

            return(Info.Secret);
        }
Exemple #4
0
        public static byte[] Open(KeyProviderQueryContext ctx)
        {
            IOConnectionInfo ioc = GetAuxFileIoc(ctx);

            Info          Info = Info.Load(ioc);
            DirectOrDango dd   = new DirectOrDango();

            UIUtil.ShowDialogAndDestroy(dd);
            try{
                if (dd.Access() == 0)
                {
                    Form1 dlg = new Form1();
                    dlg.InitEx(Info, ctx);
                    if (Info == null)
                    {
                        return(null);
                    }


                    UIUtil.ShowDialogAndDestroy(dlg);

                    if (dlg.Access() != true)
                    {
                        return(null);
                    }



                    if (!CreateAuxFile(Info, ctx))
                    {
                        return(null);
                    }

                    return(Info.Secret);
                }
                else if (dd.Access() == 1)
                {
                    try
                    {
                        Login dlgi = new Login();

                        dlgi.InitEx(Info, ctx);
                        if (Info == null)
                        {
                            return(null);
                        }


                        UIUtil.ShowDialogAndDestroy(dlgi);

                        if (System.Text.Encoding.UTF8.GetString(dlgi.Access()) != System.Text.Encoding.UTF8.GetString(Info.Secret))
                        {
                            return(null);
                        }



                        if (!CreateAuxFile(Info, ctx))
                        {
                            return(null);
                        }

                        return(Info.Secret);
                    }
                    catch (Exception) { }

                    return(null);
                }
                else
                {
                    FingerPrint fingerprint = new FingerPrint();

                    UIUtil.ShowDialogAndDestroy(fingerprint);

                    if (fingerprint.Access() != true)
                    {
                        return(null);
                    }



                    DangoLite dlg2 = new DangoLite();
                    dlg2.InitEx(Info, ctx);
                    if (Info == null)
                    {
                        return(null);
                    }
                    UIUtil.ShowDialogAndDestroy(dlg2);

                    if (dlg2.Access() != true)
                    {
                        return(null);
                    }

                    if (!CreateAuxFile(Info, ctx))
                    {
                        return(null);
                    }

                    return(Info.Secret);
                }
            }catch (Exception ex) { MessageService.ShowWarning(ex.Message); }

            return(null);
        }