Skip to content

encrypted comm mode breaks desfire's clear value operation #2773

@zhiyan114

Description

@zhiyan114

Context

When setting ValueFileType's communication mode to encrypt, the command hf mfdes value --op clear -m encrypt [... other crypto flags], the execution returns the following result:

[!] Wrong communication mode. Check settings. command: f5
[=] Key num: 0 Key algo: aes Key[16]: [AES Key]
[=] Secure channel: ev1 Command set: niso Communication mode: encrypt
[=] Session key [16]: [Session Key]
[=]     IV [16]: [IV]
[!] CRC32 error.
[!!] Desfire GetFileSettings command returns wrong data

When changing the file communication mode outside of encrypt, the command works as intended. I've used DesFire EV1 for the test. Cannot confirm if EV2/EV3 will have this issues.

Commands to Replicate The Issue

Here's all the command that's been executed leading up to the error.

hf mfdes formatpicc
hf mfdes createapp --numkeys 1 --aid 000001 --ks1 09 --dstalgo AES --no-auth
hf mfdes createvaluefile --aid 000001 --fid 01 --amode encrypt --rawrights 0000 --lower 80000000 --upper 7FFFFFFF -t aes
hf mfdes value --aid 000001 --fid 01 -t aes -m encrypt --op clear

Firmware Versions

MCU....... AT91SAM7S512 Rev A
Memory.... 512 KB ( 73% used )

Client.... Iceman/master/v4.18994-556-gb1c604c4c 2024-11-22 12:11:28
Bootrom... Iceman/master/v4.18589-402-g16b56f499-suspect 2024-09-10 11:32:01
OS........ Iceman/master/v4.18994-556-gb1c604c4c-suspect 2024-11-22 12:11:02
Target.... RDV4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions