Disclosure: As an Amazon Associate, CardWise earns from qualifying purchases at no additional cost to you. This does not affect our recommendations.

GlobalPlatform APDU vs SCP03 — Plaintext vs Encrypted Card Management

When you manage a Java Card — installing applets, updating keys, deleting applications — you send APDU commands through the GlobalPlatform Card Manager. These commands can be sent in plaintext (raw APDUs that anyone on the communication channel can read) or wrapped in a secure channel (encrypted and authenticated). SCP03 (Secure Channel Protocol 03) is GlobalPlatform's modern AES-128-based secure channel that protects card management operations from eavesdropping and tampering.

This comparison covers APDU structure, key establishment, encryption, MAC integrity, replay protection, and when each approach is appropriate.

GlobalPlatform Management Commands

GlobalPlatform defines a set of APDU commands for card management:

CommandINSFunction
SELECTA4Select an application or security domain
INSTALLE6Install/load an applet or create a security domain
DELETEE4Delete an applet, package, or key
GET STATUSF2Query card contents (applets, keys, SDs)
PUT KEYD8Upload or update cryptographic keys
STORE DATAE2Send arbitrary data to an application or SD
GET DATACARetrieve card data (card recognition number, etc.)

In plaintext mode, these APDUs are sent as-is over the communication channel. Anyone with access to the reader-to-card communication can see the commands and responses — including key material during PUT KEY operations.

In SCP03 mode, these same commands are wrapped: the command data is encrypted with a session key, and a MAC (CMAC) is appended for integrity. The card decrypts, verifies the MAC, executes the command, and returns an encrypted response.

SCP03 Architecture

Key Establishment

Pre-shared keys (stored in card's Security Domain):
  K-ENC: AES-128 key for session key derivation
  K-MAC: AES-128 key for MAC computation
  K-DEK: AES-128 key for data encryption

Initialization:
  1. Terminal sends INITIALIZE UPDATE APDU
     - Contains host challenge (random 8 bytes)
  2. Card responds with:
     - Key diversification data
     - Key information (which key version)
     - Card challenge (random 8 bytes)
     - Card cryptogram (proof that card knows K-MAC)

  3. Terminal verifies card cryptogram
  4. Terminal computes session keys:
     S-ENC = AES-CBC(K-ENC, [challenge data])
     S-MAC = AES-CBC(K-MAC, [challenge data])
     S-DEK = AES-CBC(K-DEK, [challenge data])

  5. Terminal sends EXTERNAL AUTHENTICATE
     - Contains host cryptogram (proof that terminal knows K-MAC)
  6. Card verifies host cryptogram
  7. Secure channel established

Secure APDU Wrapping

Original APDU: 80 E6 00 00 2A [install data...]
                      |
                      v
SCP03 wrapping:
  1. MAC = AES-CMAC(S-MAC, [CLA|INS|P1|P2|80|Lc|data])
  2. Encrypted data = AES-CBC(S-ENC, [install data])
  3. Final APDU: 84 E6 00 00 [Lc'] [encrypted data + MAC]

Card processing:
  1. Verify MAC (integrity check)
  2. Decrypt data with S-ENC
  3. Execute original command
  4. Encrypt response with S-ENC
  5. MAC the response with S-MAC

Comparison: Plaintext APDU vs SCP03

DimensionPlaintext APDUSCP03 Secure Channel
EncryptionNone — all data in the clearAES-128 CBC encryption
IntegrityNone — tampering undetectedAES-128 CMAC per APDU
Replay ProtectionNoneCounter-based (C-MAC sequence)
Key ExposurePUT KEY sends new keys in plaintextNew keys encrypted with S-DEK
AuthenticationNone (no mutual auth)Mutual (card + terminal prove key knowledge)
OverheadMinimal (raw APDU)+16 bytes MAC + encryption padding per APDU
Use CaseDevelopment, testing, labProduction, personalization, OTA management
Critical security note: In production, never send card management commands in plaintext. An attacker monitoring the reader-to-card communication (or a man-in-the-middle on a remote personalization link) can capture new keys during PUT KEY, install malicious applets during INSTALL, or extract card data during GET STATUS. SCP03 is mandatory for all production card management operations.

SCP Evolution: SCP01, SCP02, SCP03

ProtocolCryptoKey DerivationMACReplay ProtectionStatus
SCP01DES/3DESSimpleRetail MACSequence counterDeprecated
SCP023DESImproved (with diversification)3DES CBC-MACSequence counterLegacy (still common)
SCP03AES-128AES-CBC basedAES-CMACCounter + C-MACCurrent standard
SCP10RSA/ECDHPublic key + symmetricAES-CMACCounterFor mutual PKI auth

SCP03 replaced SCP02 because DES/3DES is deprecated in many security standards (NIST SP 800-131A requires AES for new systems). SCP03 also improved the key derivation and replay protection mechanisms.

SCP03 Key Types and Their Roles

KeyRoleUsed For
K-ENC (Static Encryption Key)Session key derivationDeriving S-ENC for command/response encryption
K-MAC (Static MAC Key)Session MAC derivationDeriving S-MAC for APDU integrity
K-DEK (Static Data Encryption Key)Data encryptionEncrypting sensitive data in commands (e.g., new keys in PUT KEY)

All three are AES-128 keys, typically diversified per card using the card's unique key set identifier and diversification data. The terminal must know the correct keys for the card's security domain to establish a secure channel.

ACR122U Smart Card Reader ACR122U Smart Card Reader — Send GlobalPlatform APDUs to Java Cards for applet installation and key management. Supports SCP03 encrypted sessions via PC/SC. — Check Price on Amazon

When to Use Each

✔ Plaintext APDU mode is acceptable if…

✔ SCP03 is mandatory if…

Related Comparisons

Summary

Plaintext APDUs are for development; SCP03 is for production. SCP03 wraps every card management command in AES-128 encryption and CMAC integrity, preventing eavesdropping, tampering, and replay. If you are managing production cards — especially over network connections (OTA) or in environments where the communication channel is not physically secure — SCP03 is non-negotiable.

Want to construct GP APDUs? Try our APDU Builder or the APDU Reference.