2011/6/2 Jakob Bieling <[email protected]>: > Hi, > > On Jun 2, 2011, at 10:02 AM, Damian Rusinek wrote: >> Unfortunately encrypting the ciper again does not decrypt it. > > In the sample code, try setting the plain text to > > uint8_t aes_plaintext[16] = { > 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, > 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a, > };
I have the following: KEY: 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F PLAIN: 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a, CIPHER: 0x4F, 0x63, 0x8c, 0x73, 0x5f, 0x61, 0x43, 0x01, 0x56, 0x78, 0x24, 0xB1, 0xA2, 0x1A, 0x4f, 0x6a When I use the the cipher as plaintext I have the new cipher: CIPHER: 0x50, 0x78, 0x40, 0xad, 0x15, 0xb6, 0x58, 0x1e, 0xa2, 0x66, 0xf2, 0xc6, 0x3f, 0xb2, 0x82, 0x76 And it looks good comparing to Aes Calc here: http://www.unsw.adfa.edu.au/~lpb/src/AEScalc/AEScalc.html > > and check what the encrypted text is. Make sure the rest of the sample code > is unchanged! > >> To >> decrypt, you need to provide generated keys in inverted order. That's >> what I want to achieve. > > I am not sure what you mean by that. In general, the CC2420 needs inversion > of the key-bytes, because the key is read like that (i.e., backwards) into > RAM. But this affects encryption as well as decryption and is already done by > that library. You should not need to invert anything. I'm not talking about key-bytes inversion. I'm talking about round keys inversion. You can check it here: http://www.unsw.adfa.edu.au/~lpb/src/AEScalc/AEScalc.html When you click encrypt and then decrypt you can see that keys are used in iverted order. > > Best, > Jakob > > >> 2011/6/2 Jakob Bieling <[email protected]>: >>> try "encryting" the cipher text again. The CC2420 AES works in CTR mode, >>> meaning encryption and decryption are the same operation. >>> >>> Moreover, if you send your packets anyway, you can use the built-in >>> functionality of the CC2420 chip to encrypt all outgoing packets on the >>> fly. It will also decrypt incoming packets automatically. TinyOS already >>> allows for this, simply Google for "tinyos cc2420 security tutorial". Note >>> that the actual wiki seems to be down, but you use the Google cache. That >>> worked for me. >>> >>> On Jun 2, 2011, at 9:07 AM, Damian Rusinek wrote: >>> >>>> Hello. >>>> I'm using 'The Standalone AES Encryption of CC2420' which is described >>>> here: >>>> http://cis.sjtu.edu.cn/index.php/The_Standalone_AES_Encryption_of_CC2420_(TinyOS_2.10_and_MICAz) >>>> >>>> I encrypt the payload of my packet before sending. >>>> The question is how can I decrypt it? >>>> Does anybody use this library? > -- > net.cs.bonn.edu/bieling > > -- Pozdrawiam, Damian Rusinek. _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
