Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Kip

Member Since 06 Feb 2013
Offline Last Active May 30 2014 11:11 PM
-----

Topics I've Started

XTEA encryption on Netduino Plus 2

11 March 2014 - 11:29 AM

Hi :D

 

I'm trying to do some basic encryption on NP2 using XTEA.

I'm using the well-tested Bouncy Castle lib, so imported the necessary source files in my project:

 

  • CryptoException.cs
  • DataLengthException.cs
  • IBlockCipher.cs
  • ICipherParameters.cs
  • KeyParameter.cs
  • Pack.cs
  • XTEAEngine.cs

then I tried it, by encoding and decoding a block of 8 bytes, using this code:

byte[] keyData = Encoding.UTF8.GetBytes("passwordpassword");

byte[] plainData = Encoding.UTF8.GetBytes("xteaxtea");
XteaEngine xteaEngine = new XteaEngine();
xteaEngine.Init(true, new KeyParameter(keyData));

byte[] outData = new byte[plainData.Length];

xteaEngine.ProcessBlock(plainData, 0, outData, 0);

XteaEngine decEngine = new XteaEngine();
decEngine.Init(false, new KeyParameter(keyData));
byte[] decData = new byte[plainData.Length];
xteaEngine.ProcessBlock(outData, 0, decData, 0);

string str = new string(Encoding.UTF8.GetChars(decData));
Debug.Print(str);

but plainData != decData, even if they should have the same data! What am I doing wrong? :\


A few issues with NP2

03 December 2013 - 09:19 AM

Hi to all! This is my first post on this forum :D

 

I have a few issues with my NP2 (fw 4.3 beta 1), first of all... often I get the "Unable to communicate with USB:Netduino" error, which I can only solve by reflashing the firmware... any clues?

 

(by the way, is source for v4.3 beta available? I'm having troubles recompiling 4.2.2.2)

 

The second problem is with storage: I have to store 32 bytes of data on chip, and I read you can't use ExtendedWeakReference... is it true?

 

Third: is there a way to use unsafe code? I read on the forum that you actually can, but everytime I try to use it, netduino just hangs and I have to reflash the firmware :

 

Fourth: every STM32F40 has a 96 bit unique ID, is it exposed somewhere?

 

The last 3 problems can be solved by compiling my own custom firmware, but I don't really want to install VS 2010, so I should just wait for v4.3 to come out and work on that firmware :

 

Sorry for the long post :D


home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.