예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            /*
             * 1. get client's pw
             * 2. decrypt Encrpyted Message, using PW then display the KEY(TGS)
             * 2. if the password is right then show ticket and Key TGS
             * 3. but current procedure is not right. actually whether pw is right or not, the values should be same, and TGSerer will check it by decrypting
             * 4. Create timestamp by system
             */
            if (pwBox.Text.Length != 8)
            {
                MessageBox.Show("Password should be 8 characters");
            }
            else
            {
                f.printProcess("\n\nMessage decryption using Password in PW Text Box(Scenario 4,5)", ncolor);
                decKey = secCol.decryption(p.getMessage(), tabCol, pwBox.Text, f); // decrypt encrypyed Key tgs using password
                p.setMessage(secCol.getCharString(decKey));
                decKeyBox.Text = p.getMessage();                                   // get char string format of decrypted message

                string[] result    = (p.getMessage()).Split(':');                  //splitting message
                string   timestamp = null;                                         // create timestamp

                timestamp += (DateTime.Now.ToString("yyyyMMddHHmm"));
                p.setTimeStamp(timestamp);
                timeStamp.Text = p.getTimeStamp();

                try
                {
                    if (result[5] != null)
                    {
                        textBox2.Text = result[5];
                        p.setTGSKey(result[5]);//Client get TGS Key by decrypting message
                    }
                }
                catch
                {
                    textBox2.Text  = "";
                    timeStamp.Text = "";
                    MessageBox.Show("Failed to decrypt Message");
                }

                button2.Enabled = true;
                mainPage.setFlag(4);
                mainPage.setFlag(5);
            }
        }