Secure Messaging
ProtocolAn ISO 7816-4 mechanism that applies cryptographic integrity and confidentiality protection to individual APDU commands and responses exchanged between card and host.
What Is Secure Messaging?
Secure MessagingSecure MessagingProtocolCryptographic protection of APDUAPDUProtocolCommunication unit between card and reader.Click to view → command/response pairs.Click to view → (SM) is an ISO 7816-4 mechanism that wraps individual APDU commands and responses with cryptographic integrity and confidentiality protection. When secure messaging is active, the data field of each APDU is encrypted, and a message authentication code (MAC) is appended, ensuring that neither the command nor the response can be eavesdropped or tampered with during transmission between the card and the host.
Secure messaging is the foundation of higher-level secure channel protocols like SCP03 in GlobalPlatform and the PACEPACEApplicationStrong ePassport authentication protocol.Click to view →/BACBACApplicationePassport security using MRZ data.Click to view → protocols in ePassport applications.
How Secure Messaging Works
ISO 7816ISO 7816StandardPrimary standard for contact smart cards.Click to view →-4 defines two levels of protection applied to APDU data:
- Integrity (MAC only) -- a cryptographic checksum computed over the command header and data field. The card verifies the MAC before processing the command, rejecting tampered messages.
- Confidentiality + Integrity -- the command data is encrypted (typically with AES or 3DES) and then a MAC is computed over the encrypted payload. This prevents both eavesdropping and modification.
The CLA byte of the APDU indicates whether secure messaging is applied:
| CLA Bit Pattern | SM Mode |
|---|---|
| 0x0C | Command header + data authenticated and encrypted |
| 0x04 | Command header authenticated, data in plain |
| 0x00 | No secure messaging |
TLV Encoding
Secure messaging uses BER-TLV (Tag-Length-Value) encoding within the APDU data field. Protected data objects use specific tags:
- Tag 87 -- padding indicator + encrypted data (confidentiality)
- Tag 97 -- expected response length (Le) under SM
- Tag 8E -- cryptographic checksum (MAC, typically 8 bytes)
- Tag 99 -- processing status (SW1-SW2) under SM in responses
Practical Applications
Secure messaging is mandatory in several smart card ecosystems:
- GlobalPlatform SCP03SCP03SoftwareAESAESCryptographyNIST symmetric block cipher for smart card encryption.Click to view →-based secure channel protocol.Click to view → -- all card management operations (applet install, key rotation) are protected by AES-based secure messaging.
- ePassport BAC/PACE -- biometric data retrieval requires establishing a secure messaging session first.
- eID cards -- personal data access is protected by secure messaging with session keys derived from PACE authentication.
Without secure messaging, APDU exchanges travel in plaintext over the contact pad or RF interface, making them vulnerable to interception in shared-reader environments.
Related Content
ISO 7816 Parts Guide
Standards & Protocols…nB 1B 1B Field Meaning CLA Class byte — channel number, secure messaging indicator INS Instruction — e.g., 0xA4 SELECT, 0xB0 READ…
Smart Card Cryptography
Security…with associated data (AEAD) and is preferred for in-applet secure messaging. Cards claiming Common Criteria EAL4+ must implement at…
eSIM and Remote SIM Provisioning
Industry ApplicationsSmart Card in IoT
Industry ApplicationsSIM to eSIM Migration Guide
Industry ApplicationsCard Personalization Systems
Developer ToolsFrequently Asked Questions
The smart card glossary is a comprehensive reference of technical terms, acronyms, and concepts used in smart card technology. It covers protocols (APDU, T=0, T=1), security (Common Criteria, EAL, HSM), hardware (SE, EEPROM, contact pad), and applications (EMV, ePassport, eSIM). It serves developers, product managers, and engineers.
Yes. SmartCardFYI provides glossary definitions in 15 languages including English, Korean, Japanese, Chinese, Spanish, Portuguese, Hindi, Arabic, French, Russian, German, Turkish, Vietnamese, Indonesian, and Thai.