Example #1
0
        public static void SaveOTP(KPOTP myOTP, PwEntry pe)
        {
            OTPHandler_Base h = GetOTPHandler(pe);

            h.SaveOTP(myOTP, pe);
            myOTP.ResetSanitizedChange();
            Program.MainForm.RefreshEntriesList();
            bool bModified = (h is OTPHandler_DB) ? (h as OTPHandler_DB).DB == Program.MainForm.ActiveDatabase : true;

            Program.MainForm.UpdateUI(false, null, false, null, true, null, bModified);
        }
Example #2
0
        public static void SaveOTP(KPOTP myOTP, PwEntry pe)
        {
            OTPHandler_Base h = GetOTPHandler(pe);

            h.SaveOTP(myOTP, pe);
            myOTP.ResetSanitizedChange();
            bool bModified = (h is OTPHandler_DB) ? (h as OTPHandler_DB).DB == Program.MainForm.ActiveDatabase : true;

            System.Windows.Forms.ListView lv = (System.Windows.Forms.ListView)Tools.GetControl("m_lvEntries");
            Tools.RefreshEntriesList(bModified);
        }
Example #3
0
        public static OTPHandler_Base GetOTPHandler(PwEntry pe)
        {
            if (pe == null)
            {
                return(null);
            }
            PwDatabase      db = pe.GetDB();
            OTPHandler_Base h  = GetOTPHandler(db);

            if (h != null)
            {
                return(h);
            }
            if (!m_EntryOTPDAOHandler.ContainsKey(ENTRYHANDLER))
            {
                m_EntryOTPDAOHandler[ENTRYHANDLER] = new OTPHandler_Entry();
            }
            return(m_EntryOTPDAOHandler[ENTRYHANDLER]);
        }
Example #4
0
        private static int ProcessReferences(PwDatabase db)
        {
            //Get DB to work on
            PwDatabase otpdb = db;

            OTPDAO.OTPHandler_DB h = GetOTPHandler(db);
            if (h != null)
            {
                if (!h.EnsureOTPUsagePossible(null))
                {
                    return(-1);
                }
                otpdb = h.OTPDB;
            }
            if (otpdb == null || !otpdb.IsOpen)
            {
                return(-1);
            }
            int i = 0;
            var b = new OTPHandler_Base();

            foreach (PwEntry pe in otpdb.RootGroup.GetEntries(true))
            {
                KPOTP otp = OTPDAO.GetOTP(pe);
                if (!otp.Valid)
                {
                    continue;
                }
                if (!otp.Issuer.ToLowerInvariant().Contains("{ref:") && !otp.Label.ToLowerInvariant().EndsWith("{ref"))
                {
                    continue;
                }
                PwEntry peMain = h is OTPHandler_DB ? (h as OTPHandler_DB).GetMainPwEntry(pe) : pe;
                b.InitIssuerLabel(otp, peMain);
                pe.CreateBackup(otpdb);
                pe.Strings.Set(Config.OTPFIELD, otp.OTPAuthString);
                i++;
            }
            return(i);
        }
Example #5
0
        public static KPOTP GetOTP(PwEntry pe)
        {
            OTPHandler_Base h = GetOTPHandler(pe);

            return(h.GetOTP(pe));
        }
Example #6
0
        public static OTPDefinition OTPDefined(PwEntry pe)
        {
            OTPHandler_Base h = GetOTPHandler(pe);

            return(h.OTPDefined(pe));
        }
Example #7
0
        public static string GetReadableOTP(PwEntry pe)
        {
            OTPHandler_Base h = GetOTPHandler(pe);

            return(h.GetReadableOTP(pe));
        }
Example #8
0
        public static bool EnsureOTPUsagePossible(PwEntry pe)
        {
            OTPHandler_Base h = GetOTPHandler(pe);

            return(h.EnsureOTPUsagePossible(pe));
        }