Beispiel #1
0
        private void VerifyButton_Click(object sender, EventArgs e)
        {
            BigInteger p = new BigInteger("6277101735386680763835789423207666416083908700390324961279", 10);
            BigInteger a = new BigInteger("-3", 10);
            BigInteger b = new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16);

            byte[] xG = FromHexStringToByte("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012");

            BigInteger n = new BigInteger("ffffffffffffffffffffffff99def836146bc9b1b4d22831", 16);

            DigitalSign     DS   = new DigitalSign(p, a, b, n, xG);
            HashFuncStrebog hash = new HashFuncStrebog(256);

            long start = DateTime.Now.Second * 1000 + DateTime.Now.Millisecond;

            byte[] H      = hash.GetHash(Encoding.Default.GetBytes(textBox1.Text));
            bool   result = DS.SingVer(H, textBox2.Text, Q);

            long finish = DateTime.Now.Second * 1000 + DateTime.Now.Millisecond;
            long time   = finish - start;

            if (result)
            {
                label4.ForeColor = Color.Green;
                label4.Text      = "Correct";
            }
            else
            {
                label4.ForeColor = Color.Red;
                label4.Text      = "Wrong";
            }
        }
Beispiel #2
0
        public Form1()
        {
            InitializeComponent();

            Q  = new ECPoint();
            d  = new BigInteger();
            p  = new BigInteger("6277101735386680763835789423207666416083908700390324961279", 10);
            a  = new BigInteger("-3", 10);
            b  = new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16);
            xG = FromHexStringToByte("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012");
            q  = new BigInteger("ffffffffffffffffffffffff99def836146bc9b1b4d22831", 16);
            DS = new DigitalSign(p, a, b, q, xG);
        }