コード例 #1
0
        /// <summary>
        /// Transmit an APDU command to the card
        /// </summary>
        /// <param name="ApduCmd">APDU Command to send to the card</param>
        /// <returns>An APDU Response from the card</returns>
        APDUResponse Transmit(APDUCommand apduCmd)
        {
            Task <SCardService.APDUResponse> task = cardClient.TransmitAsync(
                new SCardService.APDUCommand()
            {
                Class = apduCmd.Class,
                Ins   = apduCmd.Ins,
                P1    = apduCmd.P1,
                P2    = apduCmd.P2,
                Le    = apduCmd.Le,
                Data  = apduCmd.Data
            });

            SCardService.APDUResponse resp = task.Result;

            return(new APDUResponse()
            {
                SW1 = resp.SW1,
                SW2 = resp.SW2,
                Data = resp.Data
            });
        }
コード例 #2
0
        /// <summary>
        /// Transmit an APDU command to the card
        /// </summary>
        /// <param name="ApduCmd">APDU Command to send to the card</param>
        /// <returns>An APDU Response from the card</returns>
        public APDUResponse Transmit(APDUCommand apduCmd)
        {
            Task<SCardService.APDUResponse> task = cardClient.TransmitAsync(
                new SCardService.APDUCommand()
                {
                    Class = apduCmd.Class,
                    Ins = apduCmd.Ins,
                    P1 = apduCmd.P1,
                    P2 = apduCmd.P2,
                    Le = apduCmd.Le,
                    Data = apduCmd.Data
                });

            try
            {
                SCardService.APDUResponse resp = task.Result;

                return new APDUResponse()
                {
                    SW1 = resp.SW1,
                    SW2 = resp.SW2,
                    Data = resp.Data
                };
            }
            catch (AggregateException ax)
            {
                throw new Exception(ProcessAggregateException(ax));
            }
        }
コード例 #3
0
        /// <summary>
        /// Transmit an APDU command to the card
        /// </summary>
        /// <param name="ApduCmd">APDU Command to send to the card</param>
        /// <returns>An APDU Response from the card</returns>
        APDUResponse Transmit(APDUCommand apduCmd)
        {
            Task<SCardService.APDUResponse> task = cardClient.TransmitAsync(
                new SCardService.APDUCommand()
                {
                    Class = apduCmd.Class,
                    Ins = apduCmd.Ins,
                    P1 = apduCmd.P1,
                    P2 = apduCmd.P2,
                    Le = apduCmd.Le,
                    Data = apduCmd.Data
                });

            SCardService.APDUResponse resp = task.Result;

            return new APDUResponse()
            {
                SW1 = resp.SW1,
                SW2 = resp.SW2,
                Data = resp.Data
            };
        }