Example #1
0
        private void regbtgenerrsa_Click(object sender, EventArgs e)
        {
            ClientRSA clientrsa = new ClientRSA();

            regtbpublic.Text  = clientrsa.Publickey;
            regtbprivate.Text = clientrsa.Privatekey;
        }
Example #2
0
        private void regbtreg_Click(object sender, EventArgs e)
        {
            ClientRSA clientrsa = new ClientRSA();

            SafePart.src.Message message = new SafePart.src.Message();
            string filename = Filename.MasterPublicKey;
            string temp     = "1";

            temp += '\n';
            temp += message.Messagevalue;
            temp += '\n';
            try
            {
                if (Common.sendfileandstring(filename, temp))
                {
                    MessageBox.Show("注册已发送, 等待审核.");
                }
                else
                {
                    MessageBox.Show("注册已发送, 等待审核.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #3
0
 public UniversalClient()
 {
     Client                   = new TcpClient();
     Encryption               = new ClientRSA();
     clientSignature          = new Signature();
     clientSignature.clientId = FingerPrint.Value();
     clientSignature.clientIp = new WebClient().DownloadString("http://icanhazip.com");
 }
Example #4
0
        static void Main()
        {
            ClientRSA client = new ClientRSA();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new main());
        }
Example #5
0
 private void initregtab()
 {
     SafePart.src.Message message = new SafePart.src.Message();
     if (string.IsNullOrEmpty(message.Number))
     {
         regstatusvalue.Text = "没有注册的";
     }
     else
     {
         regstatusvalue.Text = "已注册";
         ClientRSA clientrsa = new ClientRSA();
         regtbpublic.Text  = clientrsa.Publickey;
         regtbprivate.Text = clientrsa.Privatekey;
     }
 }
Example #6
0
 public int DecryptInt(ByteArray itemToDecrypt)
 {
     return(BitConverter.ToInt32(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0));
 }
Example #7
0
 public string DecryptString(ByteArray strTodecrypt)
 {
     return(BitConverter.ToString(ClientRSA.Decrypt(strTodecrypt.Bytes, false)));
 }
Example #8
0
 public double DecryptDouble(ByteArray itemToDecrypt)
 {
     return(BitConverter.ToDouble(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0));
 }
Example #9
0
 public float DecryptFloat(ByteArray itemToDecrypt)
 {
     return(BitConverter.ToSingle(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0));
 }
Example #10
0
 public bool DecryptBool(ByteArray itemToDecrypt)
 {
     return(BitConverter.ToBoolean(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0));
 }
Example #11
0
 public long DecryptLong(ByteArray itemToDecrypt)
 {
     return(BitConverter.ToInt64(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0));
 }
Example #12
0
 public void Dispose()
 {
     Client          = null;
     Encryption      = null;
     clientSignature = null;
 }