예제 #1
0
        public void SchemeGrade(Scheme s)
        {
            BigInteger p      = BigInteger.Parse(s.P);
            BigInteger a      = BigInteger.Parse(s.A);
            BigInteger b      = BigInteger.Parse(s.B);
            BigInteger n      = BigInteger.Parse(s.N);
            Brush      yellow = new SolidColorBrush(Color.FromArgb(255, 228, 149, 54));

            this.select_scheme_textblock.Text = s.Name;
            if (!CurveCondition.SingularCondition(a, b, p))
            {
                this.report_singular.Text       = "Сингулярная кривая";
                this.report_singular.Foreground = Brushes.Red;
            }
            else
            {
                this.report_singular.Text       = "Не сингулярная кривая";
                this.report_singular.Foreground = Brushes.Green;
            }
            if (!CurveCondition.AnomalousCondition(p, n))
            {
                this.report_anomal.Text       = "Аномальная кривая";
                this.report_anomal.Foreground = Brushes.Red;
            }
            else
            {
                this.report_anomal.Text       = "Не аномальная кривая";
                this.report_anomal.Foreground = Brushes.Green;
            }
            if (!CurveCondition.MOVCondition(20, p, n))
            {
                this.report_mov.Text       = "Подвержена MOV атакам";
                this.report_mov.Foreground = yellow;
            }
            else
            {
                this.report_mov.Text       = "Не подвержена MOV атакам";
                this.report_mov.Foreground = Brushes.Green;
            }
            if (!CurveCondition.NLengthCondition(p, n))
            {
                this.report_nlenght.Text       = "Неприемлемый кофактор";
                this.report_nlenght.Foreground = Brushes.Red;
            }
            else
            {
                this.report_nlenght.Text       = "Допустимый кофактор";
                this.report_nlenght.Foreground = Brushes.Green;
            }
            int prot = CurveCondition.ProtectionLevel(n);

            if (prot <= 16)
            {
                this.report_protect.Text       = "Слабая защита";
                this.report_protect.Foreground = Brushes.Red;
            }
            else if (prot <= 29)
            {
                this.report_protect.Text       = "Средняя защита";
                this.report_protect.Foreground = yellow;
            }
            else if (prot <= 39)
            {
                this.report_protect.Text       = "Сильная защита";
                this.report_protect.Foreground = Brushes.Green;
            }
        }
예제 #2
0
 public void LoadScheme(Scheme sch)
 {
     this.curv = new EllipticCurve(BigInteger.Parse(sch.P), BigInteger.Parse(sch.A), BigInteger.Parse(sch.B),
                                   BigInteger.Parse(sch.N), new EllipticCurve_Point(BigInteger.Parse(sch.Gx), BigInteger.Parse(sch.Gy)));
 }