Commit fa47e066 authored by Josh Ji's avatar Josh Ji

AES padding mode, sql connect string

parent 02a565bc
No preview for this file type
......@@ -58,6 +58,7 @@
this.tabControl2 = new System.Windows.Forms.TabControl();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
......@@ -68,7 +69,7 @@
//
// selectFIDOApplet
//
this.selectFIDOApplet.Location = new System.Drawing.Point(832, 87);
this.selectFIDOApplet.Location = new System.Drawing.Point(832, 108);
this.selectFIDOApplet.Name = "selectFIDOApplet";
this.selectFIDOApplet.Size = new System.Drawing.Size(119, 23);
this.selectFIDOApplet.TabIndex = 0;
......@@ -78,7 +79,7 @@
//
// getInfo
//
this.getInfo.Location = new System.Drawing.Point(832, 116);
this.getInfo.Location = new System.Drawing.Point(832, 137);
this.getInfo.Name = "getInfo";
this.getInfo.Size = new System.Drawing.Size(119, 23);
this.getInfo.TabIndex = 1;
......@@ -98,7 +99,7 @@
//
// clearWindow
//
this.clearWindow.Location = new System.Drawing.Point(832, 58);
this.clearWindow.Location = new System.Drawing.Point(832, 79);
this.clearWindow.Name = "clearWindow";
this.clearWindow.Size = new System.Drawing.Size(119, 23);
this.clearWindow.TabIndex = 3;
......@@ -119,7 +120,7 @@
//
// getPuKxRx
//
this.getPuKxRx.Location = new System.Drawing.Point(832, 290);
this.getPuKxRx.Location = new System.Drawing.Point(832, 311);
this.getPuKxRx.Name = "getPuKxRx";
this.getPuKxRx.Size = new System.Drawing.Size(119, 23);
this.getPuKxRx.TabIndex = 7;
......@@ -129,7 +130,7 @@
//
// getAttestationPublicKey
//
this.getAttestationPublicKey.Location = new System.Drawing.Point(832, 145);
this.getAttestationPublicKey.Location = new System.Drawing.Point(832, 166);
this.getAttestationPublicKey.Name = "getAttestationPublicKey";
this.getAttestationPublicKey.Size = new System.Drawing.Size(164, 23);
this.getAttestationPublicKey.TabIndex = 8;
......@@ -139,7 +140,7 @@
//
// dumpIDSecret
//
this.dumpIDSecret.Location = new System.Drawing.Point(832, 261);
this.dumpIDSecret.Location = new System.Drawing.Point(832, 282);
this.dumpIDSecret.Name = "dumpIDSecret";
this.dumpIDSecret.Size = new System.Drawing.Size(119, 23);
this.dumpIDSecret.TabIndex = 9;
......@@ -149,7 +150,7 @@
//
// getCx
//
this.getCx.Location = new System.Drawing.Point(832, 319);
this.getCx.Location = new System.Drawing.Point(832, 340);
this.getCx.Name = "getCx";
this.getCx.Size = new System.Drawing.Size(119, 23);
this.getCx.TabIndex = 10;
......@@ -159,7 +160,7 @@
//
// getPuKxCx
//
this.getPuKxCx.Location = new System.Drawing.Point(832, 377);
this.getPuKxCx.Location = new System.Drawing.Point(832, 398);
this.getPuKxCx.Name = "getPuKxCx";
this.getPuKxCx.Size = new System.Drawing.Size(119, 23);
this.getPuKxCx.TabIndex = 11;
......@@ -250,7 +251,7 @@
//
// resetCredentials
//
this.resetCredentials.Location = new System.Drawing.Point(832, 232);
this.resetCredentials.Location = new System.Drawing.Point(832, 253);
this.resetCredentials.Name = "resetCredentials";
this.resetCredentials.Size = new System.Drawing.Size(119, 23);
this.resetCredentials.TabIndex = 13;
......@@ -260,7 +261,7 @@
//
// getCredentialCount
//
this.getCredentialCount.Location = new System.Drawing.Point(832, 203);
this.getCredentialCount.Location = new System.Drawing.Point(832, 224);
this.getCredentialCount.Name = "getCredentialCount";
this.getCredentialCount.Size = new System.Drawing.Size(134, 23);
this.getCredentialCount.TabIndex = 14;
......@@ -270,7 +271,7 @@
//
// getFreeSpace
//
this.getFreeSpace.Location = new System.Drawing.Point(832, 174);
this.getFreeSpace.Location = new System.Drawing.Point(832, 195);
this.getFreeSpace.Name = "getFreeSpace";
this.getFreeSpace.Size = new System.Drawing.Size(119, 23);
this.getFreeSpace.TabIndex = 15;
......@@ -280,7 +281,7 @@
//
// IDxBox
//
this.IDxBox.Location = new System.Drawing.Point(832, 348);
this.IDxBox.Location = new System.Drawing.Point(832, 369);
this.IDxBox.Name = "IDxBox";
this.IDxBox.PlaceholderText = "IDx";
this.IDxBox.Size = new System.Drawing.Size(119, 23);
......@@ -288,7 +289,7 @@
//
// ClientPIN_getRetries
//
this.ClientPIN_getRetries.Location = new System.Drawing.Point(1004, 58);
this.ClientPIN_getRetries.Location = new System.Drawing.Point(1004, 79);
this.ClientPIN_getRetries.Name = "ClientPIN_getRetries";
this.ClientPIN_getRetries.Size = new System.Drawing.Size(181, 23);
this.ClientPIN_getRetries.TabIndex = 17;
......@@ -298,7 +299,7 @@
//
// ClientPIN_getKeyAgreement
//
this.ClientPIN_getKeyAgreement.Location = new System.Drawing.Point(1004, 87);
this.ClientPIN_getKeyAgreement.Location = new System.Drawing.Point(1004, 108);
this.ClientPIN_getKeyAgreement.Name = "ClientPIN_getKeyAgreement";
this.ClientPIN_getKeyAgreement.Size = new System.Drawing.Size(181, 23);
this.ClientPIN_getKeyAgreement.TabIndex = 18;
......@@ -308,7 +309,7 @@
//
// pinBox
//
this.pinBox.Location = new System.Drawing.Point(1004, 116);
this.pinBox.Location = new System.Drawing.Point(1004, 137);
this.pinBox.Name = "pinBox";
this.pinBox.PlaceholderText = "PIN";
this.pinBox.Size = new System.Drawing.Size(119, 23);
......@@ -316,7 +317,7 @@
//
// SetPIN
//
this.SetPIN.Location = new System.Drawing.Point(1004, 145);
this.SetPIN.Location = new System.Drawing.Point(1004, 166);
this.SetPIN.Name = "SetPIN";
this.SetPIN.Size = new System.Drawing.Size(181, 23);
this.SetPIN.TabIndex = 20;
......@@ -363,11 +364,23 @@
this.tabPage5.Text = "load cert";
this.tabPage5.UseVisualStyleBackColor = true;
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] {
"127.0.0.1:3306",
"192.168.0.100:32306"});
this.comboBox1.Location = new System.Drawing.Point(832, 50);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(164, 23);
this.comboBox1.TabIndex = 22;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1211, 729);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.tabControl2);
this.Controls.Add(this.SetPIN);
this.Controls.Add(this.pinBox);
......@@ -388,6 +401,7 @@
this.Controls.Add(this.selectFIDOApplet);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
......@@ -435,5 +449,6 @@
private TabControl tabControl2;
private TabPage tabPage4;
private TabPage tabPage5;
private ComboBox comboBox1;
}
}
\ No newline at end of file
......@@ -238,8 +238,10 @@ namespace FidoReader
return;
}
Debug.WriteLine("Mysql Connecting ...");
#region mysql connecting
string connectString = "server=127.0.0.1;port=3306;user id=IDP;password=idppasswd;database=idp;charset=utf8;";
#region mysql connecting
string mysql_addr = comboBox1.Text.Split(':')[0];
string mysql_port = comboBox1.Text.Split(':')[1];
string connectString = "server="+ mysql_addr+ ";port="+ mysql_port+ ";user id=root;password=rootpasswd;database=idp;charset=utf8;";
MySqlConnection mySqlConnection = new MySqlConnection(connectString);
if (mySqlConnection.State != ConnectionState.Open) {
try {
......@@ -332,11 +334,11 @@ namespace FidoReader
aes.Key = hashedSharedSecrect;
aes.BlockSize = 128;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.None;
aes.Padding = PaddingMode.PKCS7;
aes.IV = IV;
// decrypt cx
byte[] decryptedCx = aes.DecryptCbc(encryptedCx, IV, PaddingMode.None);
byte[] decryptedCx = aes.DecryptCbc(encryptedCx, IV, PaddingMode.PKCS7);
paramBox.Text += "Encrypted Cx : " + BitConverter.ToString(encryptedCx) + "\r\n";
paramBox.Text += "Decrypted Cx : " + BitConverter.ToString(decryptedCx) + "\r\n";
......@@ -347,7 +349,7 @@ namespace FidoReader
Debug.WriteLine(BitConverter.ToString(IDxAndCx));
byte[] hashedIDxAndCx = sha256.ComputeHash(IDxAndCx);
paramBox.Text += "hashedIDxAndCx : " + BitConverter.ToString(hashedIDxAndCx) + "\r\n";
byte[] hmac = aes.EncryptCbc(hashedIDxAndCx, IV, PaddingMode.None);
byte[] hmac = aes.EncryptCbc(hashedIDxAndCx, IV, PaddingMode.PKCS7);
paramBox.Text += "hmac : " + BitConverter.ToString(hmac) + "\r\n";
String hmacBase64 = Convert.ToBase64String(hmac);
......@@ -807,5 +809,9 @@ namespace FidoReader
file.Close();
}
}
private void Form1_Load(object sender, EventArgs e) {
comboBox1.SelectedIndex = 0;
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment