Proxmark3 community

Research, development and trades concerning the powerful Proxmark3 device.

Remember; sharing is caring. Bring something back to the community.


"Learn the tools of the trade the hard way." +Fravia

You are not logged in.

Announcement

Time changes and with it the technology
Proxmark3 @ discord

Users of this forum, please be aware that information stored on this site is not private.

#1 2015-06-19 12:23:39

Sentinel
Contributor
Registered: 2012-11-26
Posts: 191

DES to AES mode

I want to change the card mode DES to AES mode.
Logged exchange cards and readers:
1.Send: [03 0A 00]
2.Received: [03 AF 66 12 F8 D0 91 6E 45 90]
ENCRYPT RndB = 32 f4 30 06 b3 0d ab 5d
ROTATE RndB’ = f4 30 06 b3 0d ab 5d 32
RndA = bd 4d 00 00 0a 21 00 00
3.Send: [02 AF 9D B9 C9 5A D2 8E 4A F2 CA 48 9E CE 3B F4 2F1B]
4.Received:[02 00 CB 8A D2 B5 56 4D E3 E6]
RndA’ =4d 00 00 0a 21 00 00 bd
Session Key
RndA(4)+RndB(4) =bd 4d 00 00 32 f4 30 06
5.Send:[03 C4 80 39 3D 34 DB 64 49 E8 B4 D1 EF 20 BC D8 1B 71 CF 52 EF E3 B4 80 7E 2C 52]
6.Received:[03 00] – OK

ENCRYPT {39 3D 34 DB 64 49 E8 B4 D1 EF 20 BC D8 1B 71 CF 52 EF E3 B4 80 7E 2C 52} =
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
42 63 24 00 00 00 00 00 <- 42 63 24 ?
the first two lines – a new key for AES. which means bytes 42 63 24 ?

Offline

#2 2015-06-19 14:35:28

iceman
Administrator
Registered: 2013-04-25
Posts: 9,538
Website

Re: DES to AES mode

Hard to make that conclusion from looking at the crypto exchange challange phase.  I thought there was a configuration you set, in the master application on the desfire tag.  But it was a long time I looked at it

Offline

#3 2015-06-19 15:34:15

Sentinel
Contributor
Registered: 2012-11-26
Posts: 191

Re: DES to AES mode

something that is described in the document, but it is very old. about the AES nothing written
(M075031_desfire Product Specification April 2004 Revision 3.1)
Page 37.
After the command 0xC4(ChangeKey) should be the key number. in the exchange is 80.. they added a bit?

Offline

#4 2015-06-19 17:06:44

iceman
Administrator
Registered: 2013-04-25
Posts: 9,538
Website

Re: DES to AES mode

there should be able to get 0xFF number of keys...
however, I don't see how to change des->aes...     swapping between  des and 3des is copying the same des key twice..
but aes.. hm..  I think if you use the 0x0a / 0x1a == des/3des if you auth with 0xaa(?) then the key is used as aes..

so keywise it doesn't matter..  it will be 16bytes whatever.  Its how you auth that determine the used encrypting method.

Offline

#5 2015-06-22 09:28:11

Sentinel
Contributor
Registered: 2012-11-26
Posts: 191

Re: DES to AES mode

something clear. not all the bits of the key determines the key number
The first MSBits of the key number
determins the authentication mode.
00xxxxxx  stands for standard DES
01xxxxxx  for ISO (3key3DES)
10xxxxxx  for AES authentication

Phillips, give full documentation! smile

Offline

#6 2015-06-22 09:43:42

iceman
Administrator
Registered: 2013-04-25
Posts: 9,538
Website

Re: DES to AES mode

aha, thats was interesting and good to know.
and from that info there can only be 63 keys (6bits left)

Offline

#7 2015-06-22 13:32:41

marshmellow
Contributor
From: US
Registered: 2013-06-10
Posts: 2,302

Re: DES to AES mode

64 including zero wink

Offline

#8 2015-06-22 15:12:28

iceman
Administrator
Registered: 2013-04-25
Posts: 9,538
Website

Re: DES to AES mode

Isn't key 0 always the masterkey?

Offline

#9 2015-06-22 15:22:12

marshmellow
Contributor
From: US
Registered: 2013-06-10
Posts: 2,302

Re: DES to AES mode

There is also the key 0 of the application.  Which is separate from the masterkey. 
However, most implementations I've seen have key numbers only 0-F
What are the other 2 bits for?

Offline

#10 2015-06-22 15:30:23

iceman
Administrator
Registered: 2013-04-25
Posts: 9,538
Website

Re: DES to AES mode

I've no idea actually. 64 potential keys might be enough I guess.
Its hard to key track of keys in applications. Programmers is lazy.

Offline

#11 2015-06-22 15:43:03

marshmellow
Contributor
From: US
Registered: 2013-06-10
Posts: 2,302

Re: DES to AES mode

afaik, desfire has up to 16 (0-F) main authentication keys and then
up to 16 (0-F) keys PER application programmed.  ( but i'm basing this off 3rd party programmers that may not have it right to begin with.. sad   )

Last edited by marshmellow (2015-06-22 15:43:58)

Offline

#12 2015-06-22 15:58:53

iceman
Administrator
Registered: 2013-04-25
Posts: 9,538
Website

Re: DES to AES mode

is it 28 applications or 31?

Offline

#13 2015-06-22 16:10:36

marshmellow
Contributor
From: US
Registered: 2013-06-10
Posts: 2,302

Re: DES to AES mode

28 apps each can contain up to 32 files. 

now i found documentation that says each app can be secured by up to 14 different keys which are stored in the application's internal key file. ???

by default there exists a root application with the app identifier of 0x000000 which defines the so-called transponder level (master).  that application cannot hold any files and is intended to be used for basic administration of the transponder...

Offline

#14 2015-06-26 15:32:33

Sentinel
Contributor
Registered: 2012-11-26
Posts: 191

Re: DES to AES mode

marshmellow rights
https://  github.com/  DrWhax/ovstation  /blob/master/ovknip/M075031_desfire.pdf
desfire has  16 (0-F) main authentication key, but 0x0E, 0x0F - Special keys
The first MSBits of the key number use only in command ChangeKey(KeyNo) [26 bytes] page 37 of doc M075031
M075031 - old doc, and these bits are not described here

Offline

Board footer

Powered by FluxBB