Search code examples
smartcardjavacard3desparityglobalplatform

Why my smart card accepts two different keys as its MAC key?


As you see below, I tried to list installed applets on my card using gp -list. I specify some different key:

GP: gp -mac 404142434445464748494A4B4C4D4E4F -list
AID: A000000151000000 (|....Q...|)
     ISD OP_READY: Security Domain, Card lock, Card terminate, Default selected,
 CVM (PIN) management

AID: A0000001515350 (|....QSP|)
     ExM LOADED: (none)
     A000000151535041 (|....QSPA|)


GP: gp -mac 404142434445464748494A4B4C4D4E4E -list
AID: A000000151000000 (|....Q...|)
     ISD OP_READY: Security Domain, Card lock, Card terminate, Default selected,
 CVM (PIN) management

AID: A0000001515350 (|....QSP|)
     ExM LOADED: (none)
     A000000151535041 (|....QSPA|)


GP: gp -mac 404142434445464748494A4B4C4D4E4D -list
openkms.gp.GPException: External authenticate failed SW: 6982
        at openkms.gp.GlobalPlatform.check(GlobalPlatform.java:924)
        at openkms.gp.GlobalPlatform.openSecureChannel(GlobalPlatform.java:447)
        at openkms.gp.GPTool.main(GPTool.java:280)

Why it works fine with two different keys?

404142434445464748494A4B4C4D4E4F

and

404142434445464748494A4B4C4D4E4E

Note that I tried some other cards and tools! Same output.

Is this because of that the encryption with both keys has the same output?


Solution

  • You are only flipping the parity bit which is not used nor checked by the card (or software). Which means the outcome of ciphers is the same, yes.