コード例 #1
0
        private void buttonRSADecrypt_Click(object sender, EventArgs e)
        {
            if (busy)
            {
                return;
            }

            if (ReceiverRSA == null)
            {
                MessageError("你还没有私钥!");
                return;
            }
            else if (RecEncryptedDESKey == 0)
            {
                MessageError("请先加载加密传送密钥!");
                return;
            }
            RecKey = new Bitset(64);
            try
            {
                BigInteger result = ReceiverRSA.DecryptBlock(RecEncryptedDESKey);
                RecKey.PasteBigInteger(result);
                textBoxRecKey.Text       = RecKey.ToString();
                textBoxRecRSAOutput.Text = result.ToString();
                Log("RSA解密成功");
                MessageHint("RSA解密成功,得到DES密钥!");
            }
            catch
            {
                MessageError("文件不合法,RSA私钥与加密文件不匹配。");
                RecKey = null;
            }
        }