Integrity error while trying to change key settings (PICC) for DESFire EV1 cards

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Integrity error while trying to change key settings (PICC) for DESFire EV1 cards

875件の閲覧回数
voidazos
Contributor I

When attempting to change PICC key settings on DESFire EV1 cards I get the following error: com.nxp.nfclib.exceptions.PICCException: Integrity Error SW2 = 30
at com.nxp.nfclib.desfire.DESFireUtil.invalidResponse(:229)
at com.nxp.nfclib.desfire.DESFireEV1.changeKeySettings(:879)

Here is a minimal example code causing this:

public void initNewCard(IDESFireEV1 card) {

log("Connecting to card reader");
card.getReader().connect();

log("Starting to init card with id %s, selecting app", Utilities.dumpBytes(card.getUID()));
card.selectApplication(0);

String status = card.getAuthStatus();
log("Current auth status %s", status);

EV1PICCKeySettings keySettings = (EV1PICCKeySettings) card.getKeySettings();

log(
"PICC settings: %s %s",
String.valueOf(keySettings.isPiccKeySettingsChangeable()),
String.valueOf(keySettings.isPiccMasterKeyChangeable())
);

log("Authenticating");
default2KDESAuthenticate(card);

status = card.getAuthStatus();
log("Current auth status %s", status);

card.changeKeySettings(makeInUsePICCKeySettings()); // this changeKeySettings() call causes the exception
}

private EV1PICCKeySettings makeInUsePICCKeySettings() {
EV1PICCKeySettings.Builder builder = new EV1PICCKeySettings.Builder();
builder.setPiccKeySettingsChangeable(true)
.setPiccMasterKeyChangeable(true)
.setAuthenticationRequiredForApplicationManagement(false)
.setAuthenticationRequiredForDirectoryConfigurationData(false);

return builder.build();
}

I would like to kindly ask for your help with this issue. I have tried formatting the cards and otherwise writing to them seems to work. Am I doing something wrong?

The relevant output is:
Connecting to card reader
Starting to init card with id 0x042A43B2EC6A80, selecting app
Current auth status Not Authenticated
PICC settings: true true
Authenticating
Current auth status Native

ラベル(3)
0 件の賞賛
返信
2 返答(返信)

811件の閲覧回数
KaiLi
NXP TechSupport
NXP TechSupport

Hello @voidazos 

First, you need to select an existing application and file, and successfully authenticate it, and then you can use the command (changeKey) to modify the key, please try again.

0 件の賞賛
返信

585件の閲覧回数
vincentthivent
Contributor III

Hello,

have you received the ats for the desfire card?

 

Vincent

0 件の賞賛
返信