Esempio n. 1
0
        /// <summary>
        /// Extension method to SmartCardConnection class similar to Transmit asyc method, however it accepts PCSC SDK commands.
        /// </summary>
        /// <param name="apduCommand">
        /// APDU command object to send to the ICC
        /// </param>
        /// <param name="reader">
        /// SmartCardConnection object
        /// </param>
        /// <returns>APDU response object of type defined by the APDU command object</returns>
        public static Iso7816.ApduResponse Transceive(this ICardReader reader, Iso7816.ApduCommand apduCommand)
        {
            Iso7816.ApduResponse apduRes = Activator.CreateInstance(apduCommand.ApduResponseType) as Iso7816.ApduResponse;

            byte[] resp          = new byte[256];
            int    bytesReceived = reader.Transmit(apduCommand.ToByteArray(), resp);

            Array.Resize(ref resp, bytesReceived);

            apduRes.ExtractResponse(resp);

            return(apduRes);
        }
Esempio n. 2
0
 public ApduFailedException(Iso7816.ApduResponse response, string message) : base(message)
 {
     Response = response;
 }
Esempio n. 3
0
 public ApduFailedException(Iso7816.ApduResponse response)
     : base()
 {
     Response = response;
 }