Ejemplo n.º 1
0
        /// <summary>
        /// 读卡器执行APDU指令
        /// </summary>
        /// <param name="handle"></param>
        /// <param name="apdu"></param>
        /// <returns></returns>
        public string executeAPDU(int handle, string apdu)
        {
            string str1 = apdu;

            Byte[] sendData = new byte[str1.Length / 2];
            for (int N = 0; N < (str1.Length / 2); N++)
            {
                sendData[N] = byte.Parse(str1.Substring(N * 2, 2), NumberStyles.HexNumber);
            }
            Byte[] exdata1    = new byte[1024];
            int    exdataLen1 = 0;

            //执行APDU
            CRT310.CPU_T0_C_APDU(handle, sendData.Length, sendData, exdata1, ref exdataLen1);

            int    n;
            string StrBuf = "";

            for (n = 0; n < exdataLen1; n++)
            {
                StrBuf += exdata1[n].ToString("X2");
            }
            return(StrBuf);
        }