QR Code의 암호화 서명
A standard QR code carries no proof of origin: anyone can generate a symbol containing anything, which is precisely what sticker attacks and QRishing exploit. Cryptographic signing closes that gap. The issuer signs the payload with a private key, the signature travels inside the symbol alongside the data, and any scanner holding the issuer's public key verifies it offline, with no server contact at all. Current implementations pair CBOR, a binary representation far more compact than JSON, with COSE for the signature itself. The EU Digital COVID Certificate is the reference deployment, combining CBOR, COSE signing with ECDSA P-256, zlib compression and Base45 encoding.
Cryptographic Signatures in QR Codes
Digitally signed QR codes allow offline verification of authenticity — the scanner can confirm the data has not been tampered with, without contacting a server.
The Problem
Standard QR codes have no built-in authenticity mechanism. Anyone can generate a QR code with any content. Sticker attacks and QRishing exploit this — how can a scanner know if a QR code is legitimate?
How Digital Signatures Work in QR
- The issuer creates the data payload
- The issuer signs the payload with their private key
- The signature is appended to the data and encoded in the QR code
- The verifier (scanner app) uses the issuer's public key to verify the signature
- If the signature is valid, the data is authentic and untampered
COSE and CBOR
Modern signed QR codes typically use:
- CBOR (Concise Binary Object Representation): A compact binary data format — much smaller than JSON for the same data
- COSE (CBOR Object Signing and Encryption): A framework for signing and encrypting CBOR data
The combination is space-efficient, which is critical when the signed data must fit in a QR code.
Real-World Implementation: EU DCC
The EU Digital COVID Certificate is the most prominent example:
- Health data encoded in CBOR
- Signed with COSE (ECDSA with P-256)
- Compressed with zlib
- Base45-encoded for QR code storage
- Offline-verifiable with pre-distributed public keys
Public Key Distribution
The challenge: how does the verifier get the issuer's public key?
- Embedded in the app: Public keys bundled with the scanner application
- Key server: Downloaded periodically and cached
- Blockchain: Public keys published to a distributed ledger
- Certificate chain: Standard PKI with root certificates
Practical Considerations
- Signatures add 64-128 bytes to the QR code payload (ECDSA P-256: 64 bytes)
- The total signed payload must fit within QR code capacity constraints
- Key management (rotation, revocation) is operationally complex
- Not all scanner apps support signature verification
Key Takeaways
- Digital signatures enable offline authenticity verification
- COSE/CBOR is the standard framework for signed QR code payloads
- The EU DCC demonstrated large-scale signed QR code deployment
- Public key distribution is the main operational challenge
- Signatures add 64-128 bytes — plan QR code capacity accordingly
자주 묻는 질문
Can a QR code prove which issuer created it?
Only if it is signed. Nothing in the QR specification authenticates a symbol's origin, which is exactly what sticker attacks and QRishing rely on. A cryptographic signature carried inside the payload changes that: a verifier holding the issuer's public key confirms both origin and integrity.
Why do signed QR codes use CBOR and COSE rather than JSON and JWS?
Space. CBOR represents the same structure in 50 to 70 per cent fewer bytes than JSON, and COSE is the signing framework native to CBOR as JWS is to JSON. Since the signature has to fit inside the symbol alongside the data, the compact pair is often what makes the design viable at all.
Does verifying a signed QR code require an internet connection?
No, and that is the purpose of the design. The signature travels with the data, so a verifier already holding the issuer's public key checks the symbol entirely offline. The EU Digital COVID Certificate relied on that property for checks at borders and venues without connectivity.