The CardCommand Class will allow you to create and use the ISO-7816 compliant APDUs and the SCUtil helper class can help you convert strings to byte arrays for Transmitting and converting the Smart Card response from a byte array to String for display in the UI or console. Other enums often will be used as function parameters and are self-explanatory.
Another feature is the SelectSmartCard Dialog, which lets the user select a reader from the system readers through UI. To use it, just call this static method from the SCReaser class. Also, take a look at the types you’ll be dealing with in the listing for file (can be found in the source code) Types.cs:
using System;
using System.Runtime.InteropServices;
namespace SCLib
{
public enum SCardAccessMode
{
Direct = 3,
Exclusive = 1,
Shared = 2
}
public enum SCardResponseCode
{
Cancelled = 2,
InsufficientBuffer = 8,
InvalidHandle = 3,
InvalidParameter = 4,
InvalidValue = 0x11,
NoMemory = 6,
NoService = 0x1d,
NoSmartCard = 12,
NotReady = 0x10,
NotTransacted = 0x16,
ProtoMismatch = 15,
ReaderUnavailable = 0x17,
RemovedCard = 0x69,
ResetCard = 0x68,
ServiceStopped = 30,
SharingViolation = 11,
SystemCancelled = 0x12,
Timeout = 10,
UnknownCard = 13,
UnknownReader = 9,
UnpoweredCard = 0x67,
UnresponsiveCard = 0x66,
UnsupportedCard = 0x65
}
public enum SCardContextScope
{
System = 2,
Terminal = 1,
User = 0
}
public enum SCardReaderState
{
Absent = 1,
Negotiable = 5,
Powered = 4,
Present = 2,
Specific = 6,
Swallowed = 3,
Unknown = 0
}
public enum SCardReaderCapability
{
ATRString = 0x90303,
ChannelID = 0x20110,
Characteristics = 0x60150,
CurrentBWT = 0x80209,
CurrentCLK = 0x80202,
CurrentCWT = 524810,
CurrentD = 0x80204,
CurrentEBCEncoding = 0x8020b,
CurrentF = 0x80203,
CurrentIFSC = 0x80207,
CurrentIFSD = 0x80208,
CurrentIOState = 0x90302,
CurrentN = 0x80205,
CurrentProtocolType = 0x80201,
CurrentW = 0x80206,
DeviceFriendlyName = 0x7fff0003,
DeviceInUse = 0x7fff0002,
DeviceSystemName = 0x7fff0004,
DeviceUnit = 0x7fff0001,
EscAuthRequest = 0x7a005,
EscCancel = 0x7a003,
EscReset = 0x7a000,
ExtendedBWT = 0x8020c,
ICCInterfaceStatus = 0x90301,
ICCPresence = 0x90300,
ICCTypePerATR = 0x90304,
MaxInput = 0x7a007,
PerfBytesTransmitted = 0x7ffe0002,
PerfNumTransmissions = 0x7ffe0001,
PerfTransmissionTime = 0x7ffe0003,
PowerMgmtSupport = 0x40131,
ProtocolDefaultCLK = 0x30121,
ProtocolDefaultDataRate = 0x30123,
ProtocolMaxCLK = 0x30122,
ProtocolMaxDataRate = 196900,
ProtocolMaxIFSD = 0x30125,
ProtocolTypes = 0x30120,
SuppressT1IFSRequest = 0x7fff0007,
UserAuthInputDevice = 0x50142,
UserToCardAuthDevice = 328000,
VendorIFDSerialNo = 0x10103,
VendorIFDType = 0x10101,
VendorIFDVersion = 0x10102,
VendorName = 0x10100
}
[Flags]
public enum SCardProtocolIdentifiers
{
Default = -2147483648,
Optimal = 0,
Raw = 0x10000,
T0 = 1,
T1 = 2,
Undefined = 0
}
[Flags]
public enum SCStates
{
AtrMatch = 0x40,
Changed = 2,
Empty = 0x10,
Exclusive = 0x80,
Ignore = 1,
InUse = 0x100,
Mute = 0x200,
Present = 0x20,
Unavailable = 8,
Unaware = 0,
Unknown = 4,
Unpowered = 0x400
}
[StructLayout(LayoutKind.Sequential)]
public struct SCStateInfo
{
public string sReaderName;
public SCStates nCurrentState;
public SCStates nEventState;
public byte[] vbATR;
}
[Flags]
public enum SCardMechanicalCharacteristics
{
Captures = 4,
Ejects = 2,
None = 0,
Swallows = 1
}
public enum SCardDisposition
{
Confiscate = 4,
EjectCard = 3,
LeaveCard = 0,
ResetCard = 1,
UnpowerCard = 2
}
public enum SCardControlCodes
{
Absent = 0x31002c,
Confiscate = 3211280,
Eject = 0x310018,
GetAttribute = 0x310008,
GetLastError = 0x31003c,
GetPerfCntr = 0x310040,
Power = 0x310004,
Present = 0x310028,
Protocol = 0x310030,
Read = 0x310020,
SetAttribute = 0x31000c,
State = 3211320,
Swallow = 0x31001c,
Transmit = 0x310014,
Write = 3211300
}
public enum SCardChannelType
{
IDE = 0x10,
Keyboard = 4,
Parallel = 2,
PCMCIA = 0x40,
SCSI = 8,
Serial = 1,
Unknown = 0,
USB = 0x20,
Vendor = 240
}
[Flags]
public enum SCardAuthDevices
{
Display = 0x80,
EncryptedInput = 0x8000,
Fingerprint = 8,
Image = 0x20,
Keyboard = 4,
NoDevices = 0,
Numeric = 2,
ReservedFU = 1,
Retinal = 0x10,
Voice = 0x40
}
public enum SCLibExceptionCode
{
CardCommunicationError = 2,
CardWithdrawn = 1,
DriverError = 3,
DriverException = 4,
DriverIncompatible = 5,
InvalidAPDU = 0
}
}
I believe this will be more than enough to get you started writing applications using the library, or maybe writing your own version.