APDUs (Application Protocol Data Units)
APDUs (Application Protocol Data Units) are an essential part of smart card technology. They are used to communicate between the card reader and the smart card. In this article, we will explain what APDUs are, how they work, and their different types.
What are APDUs?
APDUs are messages that are sent between the smart card and the card reader. These messages are used to transmit data and instructions between the two devices. The APDU consists of a header and a body, and the structure of the APDU is defined by the ISO 7816 standard.
The APDU header contains two parts: the command code and the instruction code. The command code specifies the type of command that is being sent, while the instruction code specifies the specific operation that is being requested. The command code is divided into four categories: interindustry commands, proprietary commands, reserved for future use, and specific to a card.
The body of the APDU contains the data that is being sent between the card reader and the smart card. The size of the body is limited by the ISO 7816 standard, which specifies that the maximum size of the body is 65,536 bytes.
How do APDUs work?
APDUs work by sending messages between the smart card and the card reader. The card reader sends a command APDU to the smart card, which is processed by the smart card. The smart card then sends a response APDU back to the card reader, which contains the result of the operation.
The communication between the card reader and the smart card is a request-response process. The card reader sends a request to the smart card, which is processed by the smart card. The smart card then sends a response back to the card reader, which contains the result of the operation.
The APDU protocol is a stateless protocol, which means that each APDU is independent of the previous APDU. This allows for efficient communication between the card reader and the smart card.
Types of APDUs
There are two types of APDUs: command APDUs and response APDUs.
Command APDUs
Command APDUs are used to send commands from the card reader to the smart card. They consist of a header and a body. The header contains the command code and the instruction code, while the body contains the data that is being sent.
The command APDU is divided into two types: short APDU and extended APDU. The short APDU is used for simple commands that do not require a large amount of data to be sent. The extended APDU is used for more complex commands that require a large amount of data to be sent.
Response APDUs
Response APDUs are used to send responses from the smart card to the card reader. They consist of a header and a body. The header contains the status code, while the body contains the data that is being sent.
The response APDU is divided into two types: short APDU and extended APDU. The short APDU is used for simple responses that do not require a large amount of data to be sent. The extended APDU is used for more complex responses that require a large amount of data to be sent.
Conclusion
In conclusion, APDUs are an essential part of smart card technology. They are used to communicate between the card reader and the smart card, and they consist of a header and a body. The header contains the command code and the instruction code, while the body contains the data that is being sent. There are two types of APDUs: command APDUs and response APDUs. The command APDU is used to send commands from the card reader to the smart card, while the response APDU is used to send responses from the smart card to the card reader. The APDU protocol is a stateless protocol, which allows for efficient communication between the card reader and the smart card.