Platforms to show: All Mac Windows Linux Cross-Platform
Back to SmartCardMBS class.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SmartCard | MBS Tools Plugin | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
The function waits for the completion of all other transactions before it begins. After the transaction starts, all other applications are blocked from accessing the smart card while the transaction is in progress.
If a transaction is held on the card for more than five seconds with no operations happening on that card, then the card is reset. Calling any of the Smart Card and Reader Access Functions or Direct Card Access Functions on the card that is transacted results in the timer being reset to continue allowing the transaction to be used.
The BeginTransaction function is a smart card and reader access function. For more information about other access functions, see Smart Card and Reader Access Functions.
Lasterror is set.
SmartCardMBS.CancelTransaction
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SmartCard | MBS Tools Plugin | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
Lasterror is set.
SmartCardMBS.Constructor Private
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SmartCard | MBS Tools Plugin | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
SmartCardMBS.Control(ControlCode as Integer, input as ptr, inputLength as UInt32, output as ptr, byref outputLength as UInt32)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SmartCard | MBS Tools Plugin | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
You can call it any time after a successful call to SmartCard.Connect and before a successful call to SmartCard.Disconnect. The effect on the state of the reader depends on the control code.
ControlCode: Control code for the operation. This value identifies the specific operation to be performed. |
inputLength: Size, in bytes, of the buffer pointed to by Input.
output: Pointer to a buffer that receives the operation's output data. This parameter can be nil if the ControlCode parameter specifies an operation that does not produce output data.
outputLength: On input the size, in bytes, of the buffer pointed to by output. On output the receives the size, in bytes, of the data stored into the buffer pointed to by output.
Lasterror is set.
SmartCardMBS.Disconnect(Disposition as Integer = 0)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SmartCard | MBS Tools Plugin | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
Disposition: Action to take on the card in the connected reader on close.
can be:
kUnpowerCard | Power down the card and reset it (Cold Reset). |
kResetCard | Reset the card (Warm Reset). |
kLeaveCard | Do not do anything special on reconnect. |
kEjectCard | Eject card. |
SmartCardMBS.EndTransaction(Disposition as Integer = 0)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SmartCard | MBS Tools Plugin | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
Completes a previously declared transaction, allowing other applications to resume interactions with the card.
Disposition: Action to take on the card in the connected reader on close. Can be Eject, Leave, Reset or Unpower. See constants.
Lasterror is set.
SmartCardMBS.GetAttrib(AttrId as UInt32) as Memoryblock
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SmartCard | MBS Tools Plugin | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
It does not affect the state of the reader, driver, or card.
The plugin first queries for size of attribute and on success queries again to get the data and return it as a memoryblock.
AttrId: The attribute ID. See kAttribute* constants.
Lasterror is set.
SmartCardMBS.ReadFile(FileID as MemoryBlock) as MemoryBlock
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SmartCard | MBS Tools Plugin | 18.5 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
Returns data as MemoryBlock or error message.
The first two bytes are status code.
For Swiss health cards, the relevant IDs are 2F06 and 2F07.
For Belgian EID:
4031 | ID RN |
4032 | SGN RN |
4033 | ID Address |
4034 | SGN Address |
4035 | ID Photo |
You find the IDs for files usually in documentation or your card!
For some cards you may first need to move down a hierarchy of folders to get an item via Transmit().
Some examples using this method:
SmartCardMBS.Reconnect(ShareMode as UInt32, PreferredProtocols as UInt32, Initialization as UInt32)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SmartCard | MBS Tools Plugin | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
This function moves a card handle from direct access to general access, or acknowledges and clears an error condition that is preventing further access to the card.
Initialization can be one of the following:
kUnpowerCard | Power down the card and reset it (Cold Reset). |
kResetCard | Reset the card (Warm Reset). |
kLeaveCard | Do not do anything special on reconnect. |
ShareMode: A flag that indicates whether other applications may form connections to the card. Use one of SmartCardMBS.kShare* constants. e.g. kShareExclusive
PreferredProtocols: A bitmask of acceptable protocols for the connection. Possible values may be combined with the OR operation. Use SmartCardMBS.kProtocol* constants. e.g. kProtocolT1
Lasterror and ActiveProtocol are set.
SmartCardMBS.SetAttrib(AttrId as UInt32, mem as Memoryblock)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SmartCard | MBS Tools Plugin | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
It does not affect the state of the reader, reader driver, or smart card. Not all attributes are supported by all readers (nor can they be set at all times) as many of the attributes are under direct control of the transport protocol.
AttrId: The attribute ID. See kAttribute* constants.
Mem: The data to store.
Lasterror is set.
SmartCardMBS.Status(byref Reader as string, byref State as Integer, byref Protocol as Integer, byref CardID as string)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SmartCard | MBS Tools Plugin | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
You can call it any time after a successful call to SCardConnect and before a successful call to SCardDisconnect. It does not affect the state of the reader or reader driver.
Provides reader name, state of card (see kState constants), Protocol (see kProtocol constants) and CardID.
State: Current state of the smart card in the reader. Upon success, it receives one of the following state indicators.
Protocol: Current protocol, if any. The returned value is meaningful only if the returned value of pdwState is kCardStateSpecific.
CardID: 32-byte buffer that receives the ATR string from the currently inserted card, if available.
Lasterror is set.
See also:
SmartCardMBS.Status(byref State as Integer, byref Protocol as Integer, byref CardID as string)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SmartCard | MBS Tools Plugin | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
Same as other Status function, but without querying the name.
Lasterror is set.
See also:
SmartCardMBS.Transmit(ioSendPci as Ptr, SendBuffer as ptr, SendLength as UInt32, ioRecvPci as ptr, RecvBuffer as Ptr, byref RecvLength as UInt32)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SmartCard | MBS Tools Plugin | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
ioSendPci:
A pointer to the protocol header structure for the instruction. This buffer is in the format of an SCARD_IO_REQUEST structure, followed by the specific protocol control information (PCI).
For the T=0, T=1, and Raw protocols, the PCI structure is constant. The smart card subsystem supplies a global T=0, T=1, or Raw PCI structure, which you can reference by using the symbols SCARD_PCI_T0, SCARD_PCI_T1, and SCARD_PCI_RAW respectively.
SendBuffer:
A pointer to the actual data to be written to the card.
For T=0, the data parameters are placed into the address pointed to by SendBuffer according to the following structure:
Type | name | Description |
Byte | Cla | The instruction class |
Byte | Ins | The instruction code |
Byte | P1 | Parameter to the instruction |
Byte | P2 | Parameter to the instruction |
Byte | P3 | Size of I/O transfer |
The data sent to the card should immediately follow the send buffer. In the special case where no data is sent to the card and no data is expected in return, P3 is not sent.
SendLength:
The length, in bytes, of the SendBuffer parameter.
For T=0, in the special case where no data is sent to the card and no data expected in return, this length must reflect that the P3 member is not being sent; the length should be 4.
ioRecvPci:
Pointer to the protocol header structure for the instruction, followed by a buffer in which to receive any returned protocol control information (PCI) specific to the protocol in use. This parameter can be nil if no PCI is returned.
RecvBuffer:
Pointer to any data returned from the card.
For T=0, the data is immediately followed by the SW1 and SW2 status bytes. If no data is returned from the card, then this buffer will only contain the SW1 and SW2 status bytes.
RecvLength:
Supplies the length, in bytes, of the RecvBuffer parameter and receives the actual number of bytes received from the smart card. This value cannot be SCARD_AUTOALLOCATE because Transmit does not support SCARD_AUTOALLOCATE.
For T=0, the receive buffer must be at least two bytes long to receive the SW1 and SW2 status bytes.
see also
https://msdn.microsoft.com/en-us/library/windows/desktop/aa379804(v=vs.85).aspx
Lasterror is set.
The items on this page are in the following plugins: MBS Tools Plugin.