Hi again,

  one more follow-up. I mixed up on-the-fly encryption with standalone 
encryption:

 - standalone encryption on the CC2420 really allows encryption only and does 
not use CTR mode, ie. if you encrypt data, you cannot decrypt it, unless you 
use a specific cipher mode (like CTR)
 - on-the-fly encryption uses CTR mode and here the process for encrypting and 
decrypting is the same (tho you would not have to care about that, since the 
chip does pretty much everything for you)

  This means, you can use the standalone encryption only in cipher modes like 
CTR, where only the encryption process is needed. Consequently, you will have 
to implement your own CTR mode, if you want to be able to decrypt your data. If 
you are not familiar with CTR, Wikipedia is a good place to start.

Best,
Jakob


On Jun 2, 2011, at 10:17 AM, Jakob Bieling wrote:

> 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,
>  };
> 
>  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.
> 
> 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
> 
> 
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

-- 
net.cs.bonn.edu/bieling


_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to