Blog | G5 Cyber Security

Mifare Data Encryption Guide

TL;DR

Encrypting data on Mifare cards is vital for security. This guide covers best practices using AES encryption, key management, and secure communication protocols to protect sensitive information stored on these cards.

1. Understanding Mifare Card Types & Encryption Capabilities

Different Mifare card types have varying levels of built-in security features. Classic 1K/4K cards offer limited encryption options (DES/3DES), while newer DESFire EV1/EV2 and Plus SLx cards support AES, which is significantly stronger.

2. Choosing an Encryption Algorithm

AES (Advanced Encryption Standard) is the recommended algorithm for Mifare cards supporting it. Specifically, AES-128 is commonly used.

3. Secure Key Management

The most critical aspect of Mifare card encryption is secure key management. Compromised keys render the entire system vulnerable.

4. Implementing AES Encryption on DESFire Cards

DESFire cards require specific commands to manage keys and perform encryption/decryption operations.

4.1 Key Setup

  1. Create a Key: Use the CREATE KEY command with appropriate key number, key type (AES), and key version.
    00 A4 04 00 07 A0 00 00 01 23 00 00 80 00
  2. Load Key: Use the LOAD KEY command to securely load the AES key into the card’s memory.
    00 A4 04 00 07 A0 00 00 02 23 01 80 00

4.2 Data Encryption/Decryption

  1. Encrypt: Use the ENCipher command with the key number and data to be encrypted.
    00 A4 04 00 07 A0 00 00 03 23 02 80 00
  2. Decrypt: Use the DECipher command with the key number and encrypted data to decrypt it.
    00 A4 04 00 07 A0 00 00 03 23 03 80 00

5. Secure Communication Protocols

Protect the communication channel between your reader and the Mifare card to prevent eavesdropping or man-in-the-middle attacks.

6. Data Integrity Checks

Ensure data hasn’t been tampered with during storage or transmission.

7. Regular Security Audits

Conduct regular security audits and penetration testing to identify vulnerabilities in your Mifare card system.

Exit mobile version