PCSC | pcsc-lite : PC/SC implementation | Telnet library
kandi X-RAY | PCSC Summary
kandi X-RAY | PCSC Summary
pcsc-lite: PC/SC implementation
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of PCSC
PCSC Key Features
PCSC Examples and Code Snippets
Community Discussions
Trending Discussions on PCSC
QUESTION
ISO/IEC 7816-3:2006 (12.1.2) defines the bytestring for a command to a Smart Card that sends data and is expected to produce some beyond a status word:
A command APDU of case 4 consists of a header, a LC field, a data field and a LE field.
ISO/IEC 7816-4:2020 (5.2) is similar. I restrict to the short case (4S) where
- LC is a byte in 01H…FFH directly coding integer NC (the number of bytes in the data field, thus discounting the 4-byte header)
- LE is a byte in 01H…FFH directly coding integer NE (the number of bytes expected from the card in response when no error occurs, discounting status words), or 00H meaning maximum (or equivalently NE=256).
In such case 4S, can LE be part of the data passed to PCSC SCardTransmit
regardless of the protocol?
In other words, when passing such command to PCSC SCardTransmit
, can we set cbSendLength
to NC+6 regardless of the protocol?
I ask because I have a reproducible issue where including LE in a command (e.g. 00 A4 09 00 02 20 03 42
with cbSendLength = 8
in a context where the card will actually return a status word 6A 82
and no data) causes SCardTransmit
to fail. The value of the LE byte is immaterial. That's with T=0 cards from different manufacturers and applications, several readers of different models but all with the same manufacturer-recommended Windows driver (GemPcCCID 4.1.4.0 of 2016-08-08 signed 2018-07-26, there). The problem vanishes with Microsoft's default CCID WUDF driver, or if I set cbSendLength
to one less (thus removing LE). I have so far found no other reader/driver configuration triggering that issue, so I'm tented to say that's a driver issue (or at least an issue of the combination of that driver and the PCSC service it's supposed to work with).
I'd like some specification that tells if it's legit to include the LE byte to SCardTransmit
, and I'd prefer something not Windows-specific.
I understand that if somewhat the application knows that the protocol T=0 is used, it's easy to omit the LE byte from the initial SCardTransmit
, and I see how LE can be handled subsequently when the card sends a 61xx status word. However some contactless Smart Card readers pretend to be T=0 when they really use the ISO/IEC 14443-4 protocol, and then the LE byte is useful in some cases, thus I don't want to use that option.
Addition: the spec of ScardTransmit has:
For T=0, in the special case where no data is sent to the card and no data expected in return, this length (of the data passed to ScardTransmit) must reflect that the
bP3
member is not being sent; the length should besizeof(CmdBytes) - sizeof(BYTE)
(that is4
, the length of the C-APDU).
Therefore, under in T=0, in cases 1, 2S, 3S, what's passed to ScardTransmit is the C-APDU, and in case 1 that differs from the C-TPDU. I'm asking if there is a reference settling about the imperative, in case 4S under T=0 specifically, to strip LE from a C-APDU (making it the C-TPDU) before passing it to ScardTransmit, similar to the above prescription to not make such conversion from C-APDU to C-TPDU in case 1 under T=0 (which ScardTransmit, the driver, or the reader will perform).
...ANSWER
Answered 2021-Sep-28 at 10:46According to ISO/IEC 7816-3:2006(E) command for T=0 protocol consists of CLA-INS-P1-P2-P3-Data, i.e. there is no any field behind data.
Clause 12.2.5 Case 4S is related to command-response pair transmission by T=0. It says: The command APDU is mapped onto the command TPDU by cutting off the Le field.
So, no Le byte is allowed at the end of command int the case 4S.
QUESTION
I want to access a PC/SC Reader (Reiner SCT) on macOS Monterey (12.0.1) using Java 8/11. (javax.smartcardio
already works in Java 11). With both Java Version,
ANSWER
Answered 2022-Jan-02 at 08:54The option with System.setProperty
works for me.
The only problem in my case was, that there was a typo in the property name. The correct property name is sun.security.smartcardio.library
QUESTION
In my case I'm using pcsc-sharp project.
I'm going to expose what I'm doing
- Select AID (In this example, a Visa Card)
Request: 00 A4 04 00 A0000000031010 00
...ANSWER
Answered 2021-Oct-12 at 11:50Finally, I found the solution, I need to select AID before execute the GPO. (It's Mandatory, it doesn't work if you try to execute GPO directly)
- Request AID --> 00 A4 04 00 A0000000031010 00
- Request GPO --> 80 A8 00 00 8302 00
After that, I was able to get GPO response.
I hope it'll help
QUESTION
I'm writing an application in c# .net that needs to communicate with nfc reader (ACR122U or in built windows WUDC). The reader will send/receive data to wristband that behaves like type 4 tag. I'm using pcsc sharp library for this: https://github.com/danm-de/pcsc-sharp. Communication is over NDEF protocol with single text record, which can be used to obtain data from wristband. Text record format is G:{nameOfParameter}. For example G:ID, G:MAC.
I'm struggling for few days with sending write message to the wristband. The command I was able to make work is APDU ReadBinary Command:
...ANSWER
Answered 2021-Aug-05 at 22:50The Type 4 NDef Spec might help at https://web.archive.org/web/20190827131645/http://apps4android.org/nfc-specifications/NFCForum-TS-Type-4-Tag_2.0.pdf
I assume you have done all the file select stuff correctly
but the update procedure in the spec says
The NDEF update procedure is:
- If the length of the NDEF message (to be written) is bigger than Maximum NDEF size-2 (see NFC File Control TLV in Section 5.1.2.1), the NDEF update procedure is aborted. Otherwise, go to item 2.
- Write the value 0000h in the NLEN field (see Table 9) using the NDEF Update command.
- Write the NDEF message in the NDEF message field (see Table 9) using one or more NDEF Update commands.
- Write the length of the NDEF message in the NLEN field (see Table 9) using the NDEF Update command.
It seems as the NLEN field has a size then your offset should never be zero but 2h
I've not tried this with Type 4 Tags but thought the spec might help you.
QUESTION
Researched this issue many times but didn't found solution of it. Working with xamarin forms version 5.0.0.2012, on win 10 os (saw many solutions for mac or linux but didn't found any for windows), using PCSC library version 5.0.0. Trying to invoke context.Establish
method while debugging on Android 8.0:
ANSWER
Answered 2021-Mar-19 at 14:25The PCSC library does not appear to explicitly support Android. In my experience, nugets that work with Xamarin.Android have explicit dependencies set for the platform, but this one does not.
The library tries to use P/Invoke wrappers around native code. You can see that there are implementations for a number of operating systems here, but I don't see any references to Android. The stack trace shows that the code is deciding to use the Linux wrapper, which makes sense. It's looking for the libpcsclite.so.1 native "C/C++" library, but it's not finding it. That library has a home page that does not reference Android.
The PCSC nuget docs state:
pcsc-sharp does not contain any device drivers. A PC/SC compliant reader + driver is mandatory.
That's the libpcsclite.so.1 . Either your Android device doesn't provide it, or if it does, it's not in a location that your Android app can find it. My Android device (running Android 9) does not have that library in any of /system/*lib* directories, which means that at least for my device someone would need to compile that native library for the CPU (usually arm64) for the device. If you can either compile the native code yourself or find someone who has, AND the native code supports the reader on your Android device, then you could get the whole thing to work.
I don't have any experience with PCSC myself - just some experience with Xamarin and native libraries.
QUESTION
I am using PHP code that relies on the package: https://pecl.php.net/package/pcsc
Finally I need to update from PHP 5 to PHP 7 (late enough). The REMI repo for CentOS unfortunately does not support PCSC for PHP7 anymore so I tried to install it manually by using the command:
...ANSWER
Answered 2021-Jan-24 at 06:44Finally I need to update from PHP 5 to PHP 7 (late enough). The REMI repo for CentOS unfortunately does not support PCSC for PHP7 anymore so I tried to install it manually by using the command:
If the extension was compatible, it would be in the repository, as all other extensions
So this looks as a dead project.
QUESTION
I'm using C# with a c# library to read out the identification data from tachograph cards.
I only need to read out the unique card ID and can do this with a driver card, I send the correct APDUs to do the trick. I'm now trying to read out the ID of a company card doing the same things, as described in the documentation I could find (ECE/TRANS/SC.1/2006/2 and sub appendixes). This doesn't work.
If I understand the documentation correctly, the problem is that after selecting a DF and an EF after that, the Authentication has to be redone (on a company card only) to read out the unique identification data from the EF. Now, reading the documentation, I can understand I have to use a "manage security environment" to set/request a public key? Then use an "internal authenticate", "get challenge", run an "external authenticate" and finally use a "read binary" to read out the data. But only after setting the logic to the correct EF. Am I correct in this matter?
If I'm correct, does anyone understand where/how I can request the public key from the card? and what algorithm is used to decrypt the challenge using the public key and eventually, what to send back to the card?
If I did not understand it correctly, can anyone explain the steps in authenticating with a tachograph smartcard? Using idiot terms would be appreciated as I'm completely new in this line of work and still trying to learn.
...ANSWER
Answered 2021-Feb-24 at 16:07I had no detailed look into Tachograph specification for years, but this might help you to start:
- a challenge is just a random number, you have to encrypt it (symmetric algorithm) or sign it (asymmetric algorithm) by yourself. The appropriate algorithm has to be defined before, since the card has to follow the same rules for checking.
- external authenticate is far more likely using symmetric cryptography (nobody likes to sign something unknown, which could also be a hash code for a message)
- there are two standardized modes for retrieving the public key:
- either as response to a special Generate Asymmetric Key Pair command (there is one, which just reads but does not generate a new key)
- or in some file to be read using standard READ commands (e. g. a certificate which has the advantage, that you may check its signature). Which case applies has to be stated in the specification.
- Manage Security Environment just informs the card, which key to use for a subsequent operation like PSO, giving its Control Reference Template, id and usage qualifier
QUESTION
Been trying to read data from my National eID using an ACS ACR1281 1S Dual Reader ICC. It requires Basic Access Control (BAC) authentication. I'm able to properly authenticate but I'm getting an error when I try to Select EF.COM (01 1E) using secure messaging following specifications from ICAO Doc 9303 Part 11
Below is the APDU Command I'm sending
...ANSWER
Answered 2020-Jul-30 at 10:56Henry, from your latest comment to @guidot it looks like you send the SELECT EF.COM twice? First without Secure Messaging which will destroy your trusted channel established with BAC, followed by the secured APDU, which then tries to use the session keys / trusted channel that no longer exists.
QUESTION
I am trying to develop a program that communicates with a PCSC USB reader using Conan and CMake with the LibLogicalAccess library. I followed the instructions of building and installing the library which seemed to have gone fine. I created a small simple console project with a "main.cpp" file. Following the C++ guide on the wiki of the library I tried to call a function from the library which resulted in a "Undefined reference to function. I know there are a lot of topics covering this but I have read as many as I could but could not seem to find the right solution.
I don't have much experience with Ubuntu/CMake/Conan/C++ so it might as well be a very simple fix.
OS: Kubuntu 18.04 Lang: C++ Related software: LibLogicalAccess 2.2.1, CMake 3.17.1, Conan 1.25.0
main.cpp
...ANSWER
Answered 2020-May-25 at 20:44Your error says:
main.cpp:(.text+0x140): undefined reference to `logicalaccess::LibraryManager::getReaderProvider(std::__cxx11::basic_string, std::allocator > const&)'
It occurs because your CMake is using libstdc++11 to link, however, Conan is configured to use libstdc++ due backward compatibility. You need to update your default libcxx:
QUESTION
I am building a Windows/Java program (using javax.smartcardio
) to communicate with Jewel/Topaz512 tags (from Innovision/Broadcom) using an ACR122U device (with a PN532 NFC Controller chip inside).
I implemented the Topaz512 protocol (from this data sheet) but only half of my commands are working.
- Some commands that work:
RID, RALL, READ, WRITE-NE, RSEG
- Some commands that don't work:
WRITE-E, READ8, WRITE-E8, WRITE-NE8
For instance, here is what I get when I send a WRITE-NO-ERASE command:
Command: FF:00:00:00:0C:D4:40:01:1A:7F:42:38:01:9A:00:17:E8
Where:
D4:40:01
is the InDataExchange command,1A:7F:42
is the WRITE-NO-ERASE command (value: 0x42, block 0x0F, byte 7),38:01:9A:00
is the 4-bytes tag UID,17:E8
is the CRC.
Response: D5:41:00:42:90:00
Here the response is correct: 0x42
. The status byte (0x00
) informs that everything went well.
And here is what I get when I send a WRITE-WITH-ERASE command:
Command: FF:00:00:00:0C:D4:40:01:53:7F:42:38:01:9A:00:28:6E
Where:
D4:40:01
is the InDataExchange command,53:7F:42
is the WRITE-WITH-ERASE command (value: 0x42, block 0x0F, byte 7),38:01:9A:00
is the 4-bytes tag UID,28:6E
is the CRC.
Response: D5:41:01:90:00
Here, the status byte (0x01
) informs of a timeout detected by the PN532. (From the PN532 documentation (p67): "Time Out, the target has not answered - 0x01")
Also when I remove the PN532 timeouts (with FF:00:00:00:06:D4:32:02:00:00:00
) non-working commands do not respond D5:41:01:90:00
, but wait longer, then I get no response.
I just tried to execute the commands using gscriptor (from the pcsc-tools suite) and I got the same behavior. Here are my results:
The script:
...ANSWER
Answered 2020-Apr-22 at 15:33Some time ago I looked into this in detail and concluded that the PN532 NFC controller chip from NXP has an issue with its firmware that prevents it from successfully transceiving some commands with NFC Forum Type 1 tags (Topaz/Jewel brands). The ACR122U is based on this chip as noted.
When I tried to write 8 byte blocks at a time using the WRITE-E8 (0x54)
command, the response received is 0x01
, a timeout waiting for the tag to respond.
Things I tried that don't work:
Including the UID echo in the InDataExchange
, I even played with the endianness of the UID echo and still the same result.
Using the inCommunicateThru
command rather than InDataExchange
and calculating the CRC1 and CRC2 values at the application level (same results)
The final conclusion I reached is:
The PN532 cannot write to pages 0x10
and greater on a Type 1 tag which makes it impossible to write to the full range of memory on popular models such as the Topaz 512.
Recommendation:
This issue was relevant in 2012 when the Topaz 512 was a great low cost yet high memory NFC tag. Now that there's the NAG215 and NTAG216 models, I recommend using those models that have high memory and universal compatibility with NFC readers.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install PCSC
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page