Shop OBEX P1 Docs P2 Docs Learn Events
Public Key Encryption - Any hope? + project photos — Parallax Forums

Public Key Encryption - Any hope? + project photos

DeskguyDeskguy Posts: 32
edited 2012-07-24 14:20 in Propeller 1
Hi,

I've been 'playing' around with some various encryption algorithms - mainly old stuff such as the Enigma machine. However, there are also some newer projects like RC4, and SHA/AES from Obex.

I'm curious as to whether anyone has any thoughts on being able to implement any current form of public key encryption on the Prop? I would plan on it only be used to encrypt a symmetric key - therefore max size of about 32 bytes. Of course, that gets around the problem of slow encryption with public key. However, the big issue is whether or not one could generate a key pair on the prop - I'm assuming that it would be exceedingly difficult. Has anyone tried it, or any guesses as to whether or not it is even feasible?

BTW, for anyone that is interested, I'm attaching a couple of photos of my current project. The programming is not even close to being finished, especially since I keep changing my mind :)

It has:
- Gadget Gangster board
- Parallax 4 x 20 LCD
- Parallax Keyboard
- 2 micro SD card slots - enables me to have different data on both cards and to duplicate cards
- Smarcard reader/writer
- XBEE radio inside
- Printer from Sparkfun (very cool addition to the project)
- the box was only about $23 from Hammond

Just for fun, I had to use the toggle covers - the red one is for zeroizing the keys and the black one I'm going to use for write protected all 3 cards

The toggle on the side is for the radio on/off. Switch on the top is printer on/off. The button is for the XBEE reset. The key lock is not exactly the most secure thing in the world :)

There are panel mounted USB and PS2 ports.

David
1000 x 750 - 110K
1000 x 750 - 99K

Comments

  • pedwardpedward Posts: 1,642
    edited 2012-07-23 14:25
    Well, the Prop 2 will have some crypto on the chip. Chip sent me a first cut of the SHA-256 algorithm ported to P2ASM, and it's very compact.

    PKI is possible, especially with PropGCC doing the heavy lifting. The trick will be cutting loose all the other stuff that most crypto packages bring along, just to get the specific algorithms you need.
  • Mark_TMark_T Posts: 1,981
    edited 2012-07-23 15:42
    Yes, there is hope. I'd better clean up and check in my Elliptic Curve routines to the Obex. In the meanwhile the raw test-vector tests:
  • DeskguyDeskguy Posts: 32
    edited 2012-07-24 06:05
    Yes, forgot about the whole GCC end of things as I've been busy using Spin and trying to learn ASM. Great, one more thing to learn :)

    You are right, it would be a good way to be able to use some existing code.

    Thanks!
  • DeskguyDeskguy Posts: 32
    edited 2012-07-24 06:07
    Very cool to think that you have figured out the Elliptic Curve routines - definitely my next project to work my way through your code and learn your techniques. I was thinking more along the RSA end of things and totally forgot about ECC. Makes sense for a more logical approach to PKI on the prop.

    Thanks for the help and pointers!

    David
  • Mark_TMark_T Posts: 1,981
    edited 2012-07-24 12:27
    The problem with RSA and other prime-modulus techniques is the size of the key has to be much larger than for symmetric crypto - ECC allows much more compact keys and this has the knock-on effect of reducing the computation required (definitely important on a microcontroller). ECC hasn't been around for as long and so the risk of a weakness in the scheme is higher than RSA/DSA etc.

    The five NIST elliptic curves that have been standardised are designed to allow particularly efficient modular arithmetic with shifts/adds (which can't be done with random primes). In ECC the key value doesn't determine the modulus so the modulus can be chosen carefully.

    I stil need to write wrapper code to perform some of the standard public key ops in terms of the elliptic curve operations, as far as I remember.
  • pedwardpedward Posts: 1,642
    edited 2012-07-24 14:20
    I would stress caution when writing cryptographic algorithms for the Propeller. The mechanics of the algorithms are fairly well sorted, they either work or don't. The issue arises when it's protocol and not mechanics that enter into the system. If you botch a piece of protocol, you can significantly impair the quality of the algorithm due to weak key generation.

    The advantage of using well vetted C code and the PropGCC compiler is that you can avoid many of the pitfalls associated with these weaknesses.
Sign In or Register to comment.