Esempio n. 1
0
        public virtual ControlResponse Control(IntPtr cardHandle, ControlCommand controlCmd)
        {
            int recvBufferLength = 255;
            int recvdLength      = recvBufferLength;

            byte[] recvData = new byte[recvBufferLength];

            uint dwControlCode = BitConverter.ToUInt32(controlCmd.ControlCode, 0);

            PCSC.SCardControl(cardHandle, dwControlCode, controlCmd.ControlData, controlCmd.ControlData.Length, recvData, recvBufferLength, ref recvdLength);

            byte[] responseData = new byte[recvdLength];
            Buffer.BlockCopy(recvData, 0, responseData, 0, recvdLength);
            ControlResponse controlResponse = new ControlResponse(responseData);

            return(controlResponse);
        }
Esempio n. 2
0
        public virtual ControlResponse Control(IntPtr cardHandle, ControlCommand controlCmd)
        {
            int recvBufferLength = 255;
            int recvdLength      = recvBufferLength;

            byte[] recvData = new byte[recvBufferLength];

            uint dwControlCode = BitConverter.ToUInt32(ByteArray.ReverseBuffer(controlCmd.ControlCode), 0);
            int  error         = PCSC.SCardControl(cardHandle, dwControlCode, controlCmd.ControlData, controlCmd.ControlData.Length, recvData, recvBufferLength, ref recvdLength);

            ThrowSmartcardException("SCardControl", error);

            byte[] responseData = new byte[recvdLength];
            Buffer.BlockCopy(recvData, 0, responseData, 0, recvdLength);
            ControlResponse controlResponse = new ControlResponse(responseData);

            return(controlResponse);
        }
Esempio n. 3
0
 /// <summary>
 /// Wraps the PCSC function SCardControl
 /// </summary>
 /// <param name="apduCmd">Command to send</param>
 /// <returns>Command response</returns>
 public override ControlResponse Control(ControlCommand controlCmd)
 {
     return Control(cardHandle, controlCmd);
 }
 /// <summary>
 /// Wraps the PCSC function SCardControl
 /// </summary>
 /// <param name="apduCmd">Command to send</param>
 /// <returns>Command response</returns>
 public override ControlResponse Control(ControlCommand controlCmd)
 {
     return(Control(cardHandle, controlCmd));
 }
Esempio n. 5
0
 abstract public ControlResponse Control(ControlCommand controlCmd);