本文整理汇总了C#中Mono.Security.ASN1.Find方法的典型用法代码示例。如果您正苦于以下问题:C# ASN1.Find方法的具体用法?C# ASN1.Find怎么用?C# ASN1.Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Security.ASN1
的用法示例。
在下文中一共展示了ASN1.Find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadCard
private void ReadCard(object o)
{
UseHourglass(true);
string selectedReader = o as string;
UpdateStatusLabel("Reading card...");
TreeView treeView = new TreeView();
TreeNode cardNode = new TreeNode("Card");
cardNode.ImageIndex = 0;
cardNode.SelectedImageIndex = 0;
treeView.Nodes.Add(cardNode);
// Tree nodes
TreeNode pseNode = null;
TreeNode fciNode = null;
ASN1 fci = null;
List<byte[]> pseIdentifiers = new List<byte[]>();
List<byte[]> applicationIdentifiers = new List<byte[]>();
ASCIIEncoding encoding = new ASCIIEncoding();
APDUCommand apdu = null;
APDUResponse response = null;
bool pseFound = false;
if (!skipPSEToolStripMenuItem.Checked)
{
pseIdentifiers.Add(encoding.GetBytes("1PAY.SYS.DDF01"));
pseIdentifiers.Add(encoding.GetBytes("2PAY.SYS.DDF01"));
}
try
{
// Now lets process all Payment System Environments
if (pseIdentifiers.Count > 0)
{
cardReader.Connect(selectedReader);
foreach (byte[] pse in pseIdentifiers)
{
apdu = new APDUCommand(0x00, 0xA4, 0x04, 0x00, pse, (byte)pse.Length);
response = cardReader.Transmit(apdu);
// Get response nescesary
if (response.SW1 == 0x61)
{
apdu = new APDUCommand(0x00, 0xC0, 0x00, 0x00, null, response.SW2);
response = cardReader.Transmit(apdu);
}
// PSE application read found ok
if (response.SW1 == 0x90)
{
pseFound = true;
pseNode = new TreeNode(String.Format("Application {0}", encoding.GetString(pse)));
pseNode.ImageIndex = 1;
pseNode.SelectedImageIndex = 1;
pseNode.Tag = pse;
cardNode.Nodes.Add(pseNode);
fciNode = new TreeNode("File Control Information");
fciNode.ImageIndex = 3;
fciNode.SelectedImageIndex = 3;
fciNode.Tag = "fci";
pseNode.Nodes.Add(fciNode);
fci = new ASN1(response.Data);
AddRecordNodes(fci, fciNode);
byte sfi = new ASN1(response.Data).Find(0x88).Value[0];
byte recordNumber = 0x01;
byte p2 = (byte)((sfi << 3) | 4);
TreeNode efDirNode = new TreeNode(String.Format("EF Directory - {0:X2}", sfi));
efDirNode.ImageIndex = 2;
efDirNode.SelectedImageIndex = 2;
efDirNode.Tag = sfi;
pseNode.Nodes.Add(efDirNode);
while (response.SW1 != 0x6A && response.SW2 != 0x83)
{
apdu = new APDUCommand(0x00, 0xB2, recordNumber, p2, null, 0x00);
response = cardReader.Transmit(apdu);
// Retry with correct length
if (response.SW1 == 0x6C)
{
apdu = new APDUCommand(0x00, 0xB2, recordNumber, p2, null, response.SW2);
response = cardReader.Transmit(apdu);
}
if (response.SW1 == 0x61)
{
apdu = new APDUCommand(0x00, 0xC0, 0x00, 0x00, null, response.SW2);
response = cardReader.Transmit(apdu);
}
if (response.Data != null)
{
TreeNode recordNode = new TreeNode(String.Format("Record - {0:X2}", recordNumber));
recordNode.ImageIndex = 4;
//.........这里部分代码省略.........