- All Superinterfaces:
com.sun.jna.Library
Implementations of this API exist on Windows, OS X, and Linux, although the symbol names and sizeof parameters differs on different platforms.
- Author:
- gematik
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.sun.jna.Library
com.sun.jna.Library.Handler -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intInfinite timeout.static final StringSpecial value used to get notified of he arrival of another smart card reader.static final intSCARD_ABSENT.static final StringGroup used when no group name is provided when listing readers.static final DwordSpecial value used when indicating the length of an output buffer.static final StringDefault group to which all readers are added when introduced into the system.static final intSCARD_EJECT_CARD.static final intSCARD_LEAVE_CARD.static final StringDeprecated.i.e. legacy valuestatic final intSCARD_NEGOTIABLE.static final intSCARD_POWERED.static final intSCARD_PRESENT.static final intSCARD_PROTOCOL_RAW.static final intSCARD_PROTOCOL_T0.static final intSCARD_PROTOCOL_T1.static final intSCARD_PROTOCOL_UNDEFINED.static final intSCARD_RESET_CARD.static final intScope system.static final intScope terminal.static final intScope user.static final intSCARD_SHARE_DIRECT.static final intSCARD_SHARE_EXCLUSIVE.static final intSCARD_SHARE_SHARED.static final intSCARD_SPECIFIC.static final intATR matches card.static final intState has changed.static final intCard removed.static final intExclusive Mode.static final intIgnore this reader.static final intShared Mode.static final intUnresponsive card.static final intCard inserted.static final intStatus unavailable.static final intApp wants status.static final intReader unknown.static final intUnpowered card.static final intSCARD_SWALLOWED.static final StringDeprecated.i.e. legacy valuestatic final intSCARD_UNKNOWN.static final intSCARD_UNPOWER_CARD.Fields inherited from interface com.sun.jna.Library
OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_SYMBOL_PROVIDER, OPTION_TYPE_MAPPER -
Method Summary
Modifier and TypeMethodDescriptionSCardConnect(ScardContext hContext, String szReader, Dword dwSharMode, Dword dwPreferredProtocols, ScardHandleByReference phCard, DwordByReference pdwActiveProtocol) Establishes a connection to a smart card.SCardDisconnect(ScardHandle hCard, Dword dwDisposition) Terminates a connection between an application and a smart card.SCardEstablishContext(Dword dwScope, com.sun.jna.Pointer pvReserved1, com.sun.jna.Pointer pvReserved2, ScardContextByReference phContext) Establishes a context.SCardGetStatusChange(ScardContext hContext, Dword dwTimeout, ScardReaderState[] rgReaderStates, Dword cReaders) Provides a status for a specific set of readers.SCardListReaders(ScardContext hContext, ByteBuffer mszGroups, ByteBuffer mszReaders, DwordByReference pcchReaders) Provides a list of readers.SCardReleaseContext(ScardContext hContext) Releases a context.SCardStatus(ScardHandle hCard, ByteBuffer mszReaderName, DwordByReference pcchReaderLen, DwordByReference pdwState, DwordByReference pdwProtocol, ByteBuffer pbAtr, DwordByReference pcbAtrLen) Retrieves the current status of a smart card in a reader.SCardTransmit(ScardHandle hCard, ScardIoRequest pioSendPci, ByteBuffer pbSendBuffer, Dword cbSendLength, ScardIoRequest pioRecvPci, ByteBuffer pbRecvBuffer, DwordByReference pcbRecvLength) Transmits data to and from a connected smart card.
-
Field Details
-
INFINITE
static final int INFINITEInfinite timeout.- See Also:
-
PNP_READER_ID
Special value used to get notified of he arrival of another smart card reader.This special value is used in
SCardGetStatusChange(ScardContext, Dword, ScardReaderState[], Dword)for being notified of the arrival of a new smart card reader.- See Also:
-
SCARD_AUTOALLOCATE
Special value used when indicating the length of an output buffer.Notes:
- Mac OS X does not (yet) support memory (auto) allocation in the PC/SC layer. So you have to use a double call mechanism. One first call to get the size to allocate and one second call with a buffer allocated at the correct size, see Ludovic Rousseau's blog
- Auto-allocation seems not to work with JAVA.
- See Also:
-
SCARD_ALL_READERS
Group used when no group name is provided when listing readers.Returns a list of all readers, regardless of what group or groups the readers are in.
- See Also:
-
SCARD_DEFAULT_READERS
Default group to which all readers are added when introduced into the system.- See Also:
-
SCARD_LOCAL_READERS
Deprecated.i.e. legacy valueUnused legacy value.This is an internally managed group that cannot be modified by using any reader group APIs. It is intended to be used for enumeration only.
- See Also:
-
SCARD_SYSTEM_READERS
Deprecated.i.e. legacy valueUnused legacy value.This is an internally managed group that cannot be modified by using any reader group APIs. It is intended to be used for enumeration only.
- See Also:
-
SCARD_PROTOCOL_UNDEFINED
static final int SCARD_PROTOCOL_UNDEFINEDSCARD_PROTOCOL_UNDEFINED.- See Also:
-
SCARD_PROTOCOL_T0
static final int SCARD_PROTOCOL_T0SCARD_PROTOCOL_T0.- See Also:
-
SCARD_PROTOCOL_T1
static final int SCARD_PROTOCOL_T1SCARD_PROTOCOL_T1.- See Also:
-
SCARD_PROTOCOL_RAW
static final int SCARD_PROTOCOL_RAWSCARD_PROTOCOL_RAW.Raw active protocol.
- See Also:
-
SCARD_LEAVE_CARD
static final int SCARD_LEAVE_CARDSCARD_LEAVE_CARD.Do not do anything special.
- See Also:
-
SCARD_RESET_CARD
static final int SCARD_RESET_CARDSCARD_RESET_CARD.Reset the card.
- See Also:
-
SCARD_UNPOWER_CARD
static final int SCARD_UNPOWER_CARDSCARD_UNPOWER_CARD.Power down the card.
- See Also:
-
SCARD_EJECT_CARD
static final int SCARD_EJECT_CARDSCARD_EJECT_CARD.Eject the card.
- See Also:
-
SCARD_SCOPE_USER
static final int SCARD_SCOPE_USERScope user.Database operations are performed within the domain of the user, see
SCardEstablishContext(Dword, Pointer, Pointer, ScardContextByReference)- See Also:
-
SCARD_SCOPE_TERMINAL
static final int SCARD_SCOPE_TERMINALScope terminal.Note: This constants is defined in
pcsclite.h.inbut not mentioned in MSDN SCardEstablishContext function- See Also:
-
SCARD_SCOPE_SYSTEM
static final int SCARD_SCOPE_SYSTEMScope system.Database operations are performed within the domain of the system. The calling application must have appropriate access permissions for any database actions, see
SCardEstablishContext(Dword, Pointer, Pointer, ScardContextByReference)- See Also:
-
SCARD_SHARE_EXCLUSIVE
static final int SCARD_SHARE_EXCLUSIVESCARD_SHARE_EXCLUSIVE.This application is not willing to share the card with other applications.
- See Also:
-
SCARD_SHARE_SHARED
static final int SCARD_SHARE_SHAREDSCARD_SHARE_SHARED.This application is willing to share the card with other applications.
- See Also:
-
SCARD_SHARE_DIRECT
static final int SCARD_SHARE_DIRECTSCARD_SHARE_DIRECT.This application is allocating the reader for its private use, and will be controlling it directly. No other applications are allowed access to it.
- See Also:
-
SCARD_STATE_UNAWARE
static final int SCARD_STATE_UNAWAREApp wants status.dwCurrentState The application is unaware of the current state, and would like to know. The use of this value results in an immediate return from state transition monitoring services. This is represented by all bits set to zero.
dwEventState Not mentioned.
- See Also:
-
SCARD_STATE_IGNORE
static final int SCARD_STATE_IGNOREIgnore this reader.dwCurrentState The application is not interested in this reader, and it should not be considered during monitoring operations. If this bit value is set, all other bits are ignored.
dwEventState This reader should be ignored.
- See Also:
-
SCARD_STATE_CHANGED
static final int SCARD_STATE_CHANGEDState has changed.dwCurrentState Not mentioned.
dwEventState There is a difference between the state believed by the application, and the state known by the resource manager. When this bit is set, the application may assume a significant state change has occurred on this reader.
- See Also:
-
SCARD_STATE_UNKNOWN
static final int SCARD_STATE_UNKNOWNReader unknown.dwCurrentState Not mentioned.
dwEventState The given reader name is not recognized by the resource manager. If this bit is set, then
SCARD_STATE_CHANGEDandSCARD_STATE_IGNOREwill also be set.- See Also:
-
SCARD_STATE_UNAVAILABLE
static final int SCARD_STATE_UNAVAILABLEStatus unavailable.dwCurrentState The application expects that this reader is not available for use. If this bit is set, then all the following bits are ignored.
dwEventState The actual state of this reader is not available. If this bit is set, then all the following bits are clear.
- See Also:
-
SCARD_STATE_EMPTY
static final int SCARD_STATE_EMPTYCard removed.dwCurrentState The application expects that there is no card in the reader. If this bit is set, all the following bits are ignored.
dwEventState There is no card in the reader. If this bit is set, all the following bits will be clear.
- See Also:
-
SCARD_STATE_PRESENT
static final int SCARD_STATE_PRESENTCard inserted.dwCurrentState The application expects that there is a card in the reader.
dwEventState There is a card in the reader.
- See Also:
-
SCARD_STATE_ATRMATCH
static final int SCARD_STATE_ATRMATCHATR matches card.dwCurrentState The application expects that there is a card in the reader with an ATR that matches one of the target cards. If this bit is set,
SCARD_STATE_PRESENTis assumed. This bit has no meaning toSCardGetStatusChangebeyondSCARD_STATE_PRESENT.dwEventState There is a card in the reader with an ATR matching one of the target cards. If this bit is set,
SCARD_STATE_PRESENTwill also be set. This bit is only returned on the TODO SCardLocateCards function.- See Also:
-
SCARD_STATE_EXCLUSIVE
static final int SCARD_STATE_EXCLUSIVEExclusive Mode.dwCurrentState The application expects that the card in the reader is allocated for exclusive use by another application. If this bit is set,
SCARD_STATE_PRESENTis assumed.dwEventState The card in the reader is allocated for exclusive use by another application. If this bit is set,
SCARD_STATE_PRESENTwill also be set.- See Also:
-
SCARD_STATE_INUSE
static final int SCARD_STATE_INUSEShared Mode.dwCurrentState The application expects that the card in the reader is in use by one or more other applications, but may be connected to in shared mode. If this bit is set,
SCARD_STATE_PRESENTis assumed.dwEventState The card in the reader is in use by one or more other applications, but may be connected to in shared mode. If this bit is set,
SCARD_STATE_PRESENTwill also be set.- See Also:
-
SCARD_STATE_MUTE
static final int SCARD_STATE_MUTEUnresponsive card.dwCurrentState The application expects that there is an unresponsive card in the reader.
dwEventState There is an unresponsive card in the reader.
- See Also:
-
SCARD_STATE_UNPOWERED
static final int SCARD_STATE_UNPOWEREDUnpowered card.dwCurrentState This implies that the card in the reader has not been powered up.
dwEventState Identical meaning as for dwCurrentState.
- See Also:
-
SCARD_UNKNOWN
static final int SCARD_UNKNOWNSCARD_UNKNOWN.The current state of the reader is unknown.
Notes:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
p = 2^m. - Hereafter the value from MSDN
Card/Reader State is used, which is identical to the value from Sun's
PlatformPCSC.java.
- See Also:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
-
SCARD_ABSENT
static final int SCARD_ABSENTSCARD_ABSENT.There is no card in the reader.
Notes:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
p = 2^m. - Hereafter the value from MSDN
Card/Reader State is used, which is identical to the value from Sun's
PlatformPCSC.java.
- See Also:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
-
SCARD_PRESENT
static final int SCARD_PRESENTSCARD_PRESENT.There is a card in the reader, but it has not been moved into position for use.
Notes:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
p = 2^m. - Hereafter the value from MSDN
Card/Reader State is used, which is identical to the value from Sun's
PlatformPCSC.java.
- See Also:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
-
SCARD_SWALLOWED
static final int SCARD_SWALLOWEDSCARD_SWALLOWED.There is a card in the reader in position for use. The card is not powered.
Notes:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
p = 2^m. - Hereafter the value from MSDN
Card/Reader State is used, which is identical to the value from Sun's
PlatformPCSC.java.
- See Also:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
-
SCARD_POWERED
static final int SCARD_POWEREDSCARD_POWERED.Power is being provided to the card, but the reader driver is unaware of the mode of the card.
Notes:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
p = 2^m. - Hereafter the value from MSDN
Card/Reader State is used, which is identical to the value from Sun's
PlatformPCSC.java.
- See Also:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
-
SCARD_NEGOTIABLE
static final int SCARD_NEGOTIABLESCARD_NEGOTIABLE.The card has been reset and is awaiting PTS negotiation.
Notes:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
p = 2^m. - Hereafter the value from MSDN
Card/Reader State is used, which is identical to the value from Sun's
PlatformPCSC.java.
- See Also:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
-
SCARD_SPECIFIC
static final int SCARD_SPECIFICSCARD_SPECIFIC.The card has been reset and specific communication protocols have been established.
Notes:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
p = 2^m. - Hereafter the value from MSDN
Card/Reader State is used, which is identical to the value from Sun's
PlatformPCSC.java.
- See Also:
- If p is defined as the value from pcsclite.h.in and
m is defined as the value from MSDN
Card/Reader State then it is:
-
-
Method Details
-
SCardEstablishContext
Dword SCardEstablishContext(Dword dwScope, @Nullable com.sun.jna.Pointer pvReserved1, @Nullable com.sun.jna.Pointer pvReserved2, ScardContextByReference phContext) Establishes a context.The SCardEstablishContext function establishes the resource manager context (the scope) within which database operations are performed.
Remarks:
- The context handle returned by the SCardEstablishContext function can be used by database query and management functions. For more information, see Smart Card Database Query Functions and Smart Card Database Management Functions.
- To release an established resource manager context, use
SCardReleaseContext(de.gematik.smartcards.pcsc.lib.ScardContext).
- Parameters:
dwScope- [in] Scope of the resource manager context. This parameter can be one of the following values.SCARD_SCOPE_USERDatabase operations are performed within the domain of the user.SCARD_SCOPE_SYSTEMDatabase operations are performed within the domain of the system. The calling application must have appropriate access permissions for any database actions.
pvReserved1- [in] Reserved for future use and must beNULL. This parameter will allow a suitably privileged management application to act on behalf of another user.pvReserved2- [in] Reserved for future use and must beNULL.phContext- [out] A handle to the established resource manager context. This handle can now be supplied to other functions attempting to do work within this context.- Returns:
- If the function succeeds, the function returns
SCARD_S_SUCCESS. If the function fails, it returns an error code. For more information, see Smart Card Return Values orPcscStatus. - See Also:
-
SCardListReaders
Dword SCardListReaders(@Nullable ScardContext hContext, @Nullable ByteBuffer mszGroups, @Nullable ByteBuffer mszReaders, DwordByReference pcchReaders) Provides a list of readers.The SCardListReaders function provides the list of readers within a set of named reader groups, eliminating duplicates.
The caller supplies a list of reader groups, and receives the list of readers within the named groups. Unrecognized group names are ignored. This function only returns readers within the named groups that are currently attached to the system and available for use.
Remarks:
- The SCardListReaders function is a database query function. For more information about other database query functions, see Smart Card Database Query Functions.
- Parameters:
hContext- [in] Handle that identifies the resource manager context for the query. The resource manager context can be set by a previous call toSCardEstablishContext(de.gematik.smartcards.pcsc.lib.Dword, com.sun.jna.Pointer, com.sun.jna.Pointer, de.gematik.smartcards.pcsc.lib.ScardContextByReference). If this parameter is set toNULL, the search for readers is not limited to any context.mszGroups- [in, optional] Names of the reader groups defined to the system, as a multi-string. Use aNULLvalue to list all readers in the system (that is, the "SCard$AllReaders" group), seeSCARD_ALL_READERS,SCARD_DEFAULT_READERS,SCARD_LOCAL_READERS,SCARD_SYSTEM_READERS.mszReaders- [out] Multi-string that lists the card readers within the supplied reader groups. If this value isNULL,SCardListReadersignores the buffer length supplied inpcchReaders, writes the length of the buffer that would have been returned if this parameter had not beenNULLtopcchReaders, and returns a success code.pcchReaders- [in, out] Length of themszReadersbuffer in characters. This parameter receives the actual length of the multi-string structure, including all trailingNULLcharacters. If the buffer length is specified asSCARD_AUTOALLOCATE, thenmszReadersis converted to a pointer to a byte pointer, and receives the address of a block of memory containing the multi-string structure. This block of memory must be deallocated with TODO #SCardFreeMemory.- Returns:
- This function returns different values depending on whether it succeeds or fails.
- Success:
SCARD_S_SUCCESS - Group contains no readers:
SCARD_E_NO_READERS_AVAILABLE - Specified reader is not currently available for use:
SCARD_E_READER_UNAVAILABLE - Other: An error code. For more information, see Smart
Card Return Values or
PcscStatus.
- Success:
- See Also:
-
SCardGetStatusChange
Dword SCardGetStatusChange(ScardContext hContext, Dword dwTimeout, ScardReaderState[] rgReaderStates, Dword cReaders) Provides a status for a specific set of readers.The SCardGetStatusChange function blocks execution until the current availability of the cards in a specific set of readers changes.
The caller supplies a list of readers to be monitored by an
ScardReaderStatearray and the maximum amount of time (in milliseconds) that it is willing to wait for an action to occur on one of the listed readers. Note that SCardGetStatusChange uses the user-supplied value in thedwCurrentStatemembers of thergReaderStatesarray as the definition of the current state of the readers. The function returns when there is a change in availability, having filled in thedwEventStatemembers ofrgReaderStatesappropriately.Remarks:
- The SCardGetStatusChange function is a smart card tracking function. For more information about other tracking functions, see MSDN Smart Card Tracking Functions.
- Parameters:
hContext- [in] A handle that identifies the resource manager context The resource manager context is set by a previous call toSCardEstablishContext(Dword, Pointer, Pointer, ScardContextByReference).dwTimeout- [in] The maximum amount of time, in milliseconds, to wait for an action. A value of zero causes the function to return immediately. A value ofINFINITEcauses this function never to time out.rgReaderStates- [in, out] An array ofScardReaderStatestructures that specify the readers to watch, and that receives the result.
To be notified of the arrival of a new smart card reader, set theszReadermember of aScardReaderStatestructure toPNP_READER_ID, and set all of the other members of that structure to zero.
Important: Each member of each structure in this array must be initialized to zero and then set to specific values as necessary. If this is not done, the function will fail in situations that involve remote card readers.cReaders- [in] The number of elements in thergReaderStatesarray.- Returns:
- This function returns different values depending on whether it succeeds or fails.
- Success:
SCARD_S_SUCCESS - Failure: An error code. For more information, see Smart
Card Return Values or
PcscStatus.
- Success:
- See Also:
-
SCardConnect
Dword SCardConnect(ScardContext hContext, String szReader, Dword dwSharMode, Dword dwPreferredProtocols, ScardHandleByReference phCard, DwordByReference pdwActiveProtocol) Establishes a connection to a smart card.The SCardConnect function establishes a connection (using a specific resource manager context) between the calling application and a smart card contained by a specific reader. If no card exists in the specified reader, an error is returned.
Remarks:
- The SCardConnect function is a smart card and reader access function. For more information about other access functions, see Smart Card and Reader Access Functions.
- Parameters:
hContext- [in] A handle that identifies the resource manager context The resource manager context is set by a previous call toSCardEstablishContext(Dword, Pointer, Pointer, ScardContextByReference).szReader- [in] The name of the reader that contains the target card.dwSharMode- [in] A flag that indicates whether other applications may form connections to the card. SeeSCARD_SHARE_SHARED,SCARD_SHARE_EXCLUSIVE,SCARD_SHARE_DIRECT.dwPreferredProtocols- [in] A bitmask of acceptable protocols for the connection. Possible values may be combined with the OR operation.SCARD_PROTOCOL_T0:T=0is an acceptable protocol.SCARD_PROTOCOL_T1:T=1is an acceptable protocol.SCARD_PROTOCOL_UNDEFINED: This parameter may be zero only ifdwShareModeis set toSCARD_SHARE_DIRECT. In this case, no protocol negotiation will be performed by the drivers until anIOCTL_SMARTCARD_SET_PROTOCOLcontrol directive is sent with TODO SCardControl.
phCard- [out] A handle that identifies the connection to the smart card in the designated reader.pdwActiveProtocol- [out] A flag that indicates the established active protocol.SCARD_PROTOCOL_T0:T=0is the active protocol.SCARD_PROTOCOL_T1:T=1is the active protocol.SCARD_PROTOCOL_UNDEFINED:SCARD_SHARE_DIRECThas been specified, so that no protocol negotiation has occurred. It is possible that there is no card in the reader.
- Returns:
- This function returns different values depending on whether it succeeds or fails.
- Success:
SCARD_S_SUCCESS - Failure: An error code. For more information, see Smart
Card Return Values or
PcscStatus. SCARD_E_NOT_READYThe reader was unable to connect to the card.
- Success:
- See Also:
-
SCardStatus
Dword SCardStatus(ScardHandle hCard, @Nullable ByteBuffer mszReaderName, DwordByReference pcchReaderLen, DwordByReference pdwState, DwordByReference pdwProtocol, ByteBuffer pbAtr, DwordByReference pcbAtrLen) Retrieves the current status of a smart card in a reader.The SCardStatus function provides the current status of a smart card in a reader. You can call it any time after a successful call to
SCardConnect(de.gematik.smartcards.pcsc.lib.ScardContext, java.lang.String, de.gematik.smartcards.pcsc.lib.Dword, de.gematik.smartcards.pcsc.lib.Dword, de.gematik.smartcards.pcsc.lib.ScardHandleByReference, de.gematik.smartcards.pcsc.lib.DwordByReference)and before a successful call toSCardDisconnect(de.gematik.smartcards.pcsc.lib.ScardHandle, de.gematik.smartcards.pcsc.lib.Dword). It does not affect the state of the reader or reader driver.Remarks:
- The SCardStatus function is a smart card and reader access function. For information about other access functions, see Smart Card and Reader Access Functions.
- For the T=0 protocol, the data received back are the SW1 and SW2 status codes, possibly preceded by response data.
- Parameters:
hCard- [in] Reference value obtained fromSCardConnect(de.gematik.smartcards.pcsc.lib.ScardContext, java.lang.String, de.gematik.smartcards.pcsc.lib.Dword, de.gematik.smartcards.pcsc.lib.Dword, de.gematik.smartcards.pcsc.lib.ScardHandleByReference, de.gematik.smartcards.pcsc.lib.DwordByReference).mszReaderName- [out] List of display names (multiple string) by which the currently connected reader is known.pcchReaderLen- [in, out, optional] On input, supplies the length of themszReaderNamebuffer. On output, receives the actual length (in characters) of the reader name list, including the trailingNULLcharacter. If this buffer length is specified asSCARD_AUTOALLOCATE, thenmszReaderNameis converted to a pointer to a byte pointer, and it receives the address of a block of memory that contains the multiple-string structure.pdwState- [out, optional] Current state of the smart card in the reader. Upon success, it receives one of the following state indicators.pdwProtocol- [out, optional] Current protocol, if any. The returned value is meaningful only if the returned value ofpdwStateisSCARD_SPECIFIC.SCARD_PROTOCOL_RAW: The Raw Transfer protocol is in use.SCARD_PROTOCOL_T0: The ISO/IEC 7816-3 T=0 protocol is in use.SCARD_PROTOCOL_T1: The ISO/IEC 7816-3 T=1 protocol is in use.
pbAtr- [out] Pointer to a byte buffer that receives the Answer-To-Reset from the currently inserted card, if available.pcbAtrLen- [in, out, optional] On input, supplies the length of thepbAtrbuffer. On output, receives the number of bytes in the ATR string (32 bytes maximum). If this buffer length is specified asSCARD_AUTOALLOCATE, thenpbAtris converted to a pointer to a byte pointer, and it receives the address of a block of memory that contains the multiple-string structure.
Remark afi: I am pretty sure that here thirty three bytes is the maximum. For explanation seeAnswerToReset.MAX_ATR_SIZE.- Returns:
- If the function successfully provides the current status of a smart card in a reader,
the return value is
PcscStatus.SCARD_S_SUCCESS. If the function fails, it returns an error code. For more information, see Smart Card Return Values orPcscStatus. - See Also:
-
SCardTransmit
Dword SCardTransmit(ScardHandle hCard, ScardIoRequest pioSendPci, ByteBuffer pbSendBuffer, Dword cbSendLength, @Nullable ScardIoRequest pioRecvPci, ByteBuffer pbRecvBuffer, DwordByReference pcbRecvLength) Transmits data to and from a connected smart card.The SCardTransmit function sends a service request to the smart card and expects to receive data back from the card.
Remarks:
- The SCardTransmit function is a smart card and reader access function. For information about other access functions, see Smart Card and Reader Access Functions.
- For the T=0 protocol, the data received back are the SW1 and SW2 status codes, possibly preceded by response data.
- Parameters:
hCard- [in] A reference value obtained from theSCardConnect(de.gematik.smartcards.pcsc.lib.ScardContext, java.lang.String, de.gematik.smartcards.pcsc.lib.Dword, de.gematik.smartcards.pcsc.lib.Dword, de.gematik.smartcards.pcsc.lib.ScardHandleByReference, de.gematik.smartcards.pcsc.lib.DwordByReference)function.pioSendPci- [in] A pointer to the protocol header structure for the instruction. This buffer is in the format of anScardIoRequeststructure, followed by the specific protocol control information (PCI).
For theT=0,T=1, andRAWprotocols, the PCI structure is constant. The smart card subsystem supplies a globalT=0,T=1, orRawPCI structure.pbSendBuffer- [in] 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 {code pbSendBuffer} according to the following structure:
struct{ BYTE CLA, INS, P1, P2, P3;} CmdBytes.
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 (i.e. case 1 according to ISO/IEC 7816-3:2006 12.1.2), P3 is not sent.
Remark afi: I am pretty sure that P3 is sent to the card, see ISO/IEC 7816-3:2006 12.2.2.cbSendLength- [in] The length, in bytes, of thepbSendBufferparameter.
ForT=0, in the special case where no data is sent to the card and no data expected in return (i.e. case 1 according to ISO/IEC 7816-3:2006 12.1.2), this length must reflect that the P3 member is not being sent.
Remark afi: I am pretty sure that P3 is sent to the card, see ISO/IEC 7816-3:2006 12.2.2.pioRecvPci- [in, out, optional] 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 beNULLif no PCI is returned.pbRecvBuffer- [out] Pointer to any data returned from the card.
ForT=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.pcbRecvLength- [in, out] Supplies the length, in bytes, of thepbRecvBufferparameter and receives the actual number of bytes received from the smart card. This value cannot beSCARD_AUTOALLOCATEbecauseSCardTransmitdoes not supportSCARD_AUTOALLOCATE.
ForT=0, the receive buffer must be at least two bytes long to receive the SW1 and SW2 status bytes.- Returns:
- If the function successfully sends a service request to the smart card, the return
value is
PcscStatus.SCARD_S_SUCCESS. If the function fails, it returns an error code. For more information, see Smart Card Return Values orPcscStatus. - See Also:
-
SCardDisconnect
Terminates a connection between an application and a smart card.The SCardDisconnect function terminates a connection previously opened between the calling application and a smart card in the target reader.
Remarks:
- If an application (which previously called
SCardConnect(de.gematik.smartcards.pcsc.lib.ScardContext, java.lang.String, de.gematik.smartcards.pcsc.lib.Dword, de.gematik.smartcards.pcsc.lib.Dword, de.gematik.smartcards.pcsc.lib.ScardHandleByReference, de.gematik.smartcards.pcsc.lib.DwordByReference)) exits without calling SCardDisconnect, the card is automatically reset. - The SCardDisconnect function is a smart card and reader access function. For more information about other access functions, see Smart Card and Reader Access Functions.
- Parameters:
hCard- [in] Reference value obtained from a previous call toSCardConnect(de.gematik.smartcards.pcsc.lib.ScardContext, java.lang.String, de.gematik.smartcards.pcsc.lib.Dword, de.gematik.smartcards.pcsc.lib.Dword, de.gematik.smartcards.pcsc.lib.ScardHandleByReference, de.gematik.smartcards.pcsc.lib.DwordByReference).dwDisposition- [in] Action to take on the card in the connected reader on close.SCARD_LEAVE_CARD: Do not do anything special.SCARD_RESET_CARD: Reset the card.SCARD_UNPOWER_CARD: Power down the card.SCARD_EJECT_CARD: Eject the card.
- Returns:
- This function returns different values depending on whether it succeeds or fails.
- Success:
SCARD_S_SUCCESS - Failure: An error code. For more information, see Smart
Card Return Values or
PcscStatus.
- Success:
- See Also:
- If an application (which previously called
-
SCardReleaseContext
Releases a context.The SCardReleaseContext function closes an established resource manager context freeing any resources allocated under that context, including
SCARDHANDLEobjects and memory allocated using theSCARD_AUTOALLOCATElength designator.- Parameters:
hContext- [in] Handle that identifies the resource manager context The resource manager context is set by a previous call toSCardEstablishContext(de.gematik.smartcards.pcsc.lib.Dword, com.sun.jna.Pointer, com.sun.jna.Pointer, de.gematik.smartcards.pcsc.lib.ScardContextByReference).- Returns:
- This function returns different values depending on whether it succeeds or fails.
- Success:
SCARD_S_SUCCESS - Failure: An error code. For more information, see Smart
Card Return Values or
PcscStatus.
- Success:
- See Also:
-