问题描述
我使用 ELYCTIS CL Reader 从智能卡读取数据(我尝试了生物识别卡和护照)但我只能检索到 ATR 代码和序列号 是否有任何解释可以从卡中检索数据, 这张图片解释了我试图做的事情;我使用一个包含 APDU 的文件并执行它,上面的代码用于执行按钮 enter image description here enter image description here
private void buttonExecute_Click(object sender,EventArgs e)
{
try
{
if (!m_iCard.Connected)
{
MessageBox.Show("You first need to create a connection with the card.","No connection available");
}
else
{
APDUScript script = (APDUScript)comboBoxScript.SelectedItem;
if (script == null)
{
}
byte[] baCmdBuffer;
byte[] baRespBuffer;
long count = 0;
foreach (APDUInstruction ai in script.listAPDU)
{
baCmdBuffer = APDUScript.toBytes(ai.Command);
count += baCmdBuffer.Length;
baRespBuffer = m_iCard.Transmit(baCmdBuffer,(uint)baCmdBuffer.Length);
count += baRespBuffer.Length;
// Add trace if required
if (checkBoxTrace.Checked)
{
StringBuilder sb = new StringBuilder(ai.Comment);
sb.Append("\r\n");
sb.Append("Send=>");
sb.Append(ai.Command);
sb.Append("\r\n");
sb.Append("Get<=");
String resp = APDUScript.toHexaString(baRespBuffer);
sb.Append(resp);
sb.Append("\r\n");
// Check the response with the expected one
Regex respRegex = new Regex("^" + ai.Resp.Replace('x','.') + "$");
if (!respRegex.IsMatch(resp))
{
sb.Append("The response doesn't match the expected one ");
sb.Append(ai.Resp);
sb.Append("\r\n");
}
if (checkBoxTime.Checked)
sb.Append(String.Format("time {0:0,0 ms}.",StopTimer()));
sb.Append("\r\n");
addLogMsg(sb.ToString());
}
}
double time = StopTimer();
addLogMsg(String.Format("{0:0,0} APDU bytes transferred in {1:0,0 ms}.\r\n",count,time));
}
}
catch (Exception exc)
{
addLogMsg(exc.Message + "\r\n");
}
}
private void buttonClear_Click(object sender,EventArgs e)
{
textBoxLog.Text = "";
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)