How do I decrypt messages on my Repetier firmware?

I need to send a complex password to my machine. The machine needs to decrypt it and run it. I have not found enough resources for such an operation.

More detailed description:

I am developing a new feature for my 3D printer which runs on Repetier. (It may be on a different firmware that I can do this job). I want to change my 3D printer so it can understand special encrypted G-codes alongside normal g-codes. Lets describe it with an example:

Normally, 3D printers can read and apply standard g-code files like:

G28
G0 X10 Y20 E30
.
.
.
etc.

But I am developing a g-code encryption method which encrypts any g-code and turns it into a text like:  

M999 !4#^
M999 ^s+.&&/..* ….
.
.
etc.

I want to change the firmware for my printer so it understands if the related g-code is encrypted by checking every line if it stars with M999 (or starts with some other pattern character which I will decide later).

To do is, I need to understand how Repetier works, especially how command debug works and how I can parse my encrypted code from my encrypted g-code file.

I could not understand how repetier.h / command.cpp works and how it parses the line and redirects to functional cases.

Comments

  • Parsing incoming data is done in GCode.cpp/h and depends on data format ascii or binary.

    Please also consider
    a) It is useless since you need to publish your sources according to license.
    b) Hosts will not send it correctly.
    c) The tiny processor is not able to handle real encryption so it is more obfuscation you do here and not encryption
  • edited August 2017
    Thanks for the answer, it's a school project and I do not have to do it this way
    
    
    I have an idea like this:
    
    i will make a program(C# form application etc.) The program will look at the code I sent, If the code I send contains the character I want, The machine will send the repetier host by decrypting the password of this code. If it does not contain the sign I want, send it directly.
    
    How do you think this is and how can I do it? 
  • "The machine will send the repetier host by decrypting the password of this code"

    not sure what you want to say here, but is definitely not clear what you try. Host would send to firmware. So you need a new connector in host that does the encryption and a firmware port with new protocol for encryption where you enable it for example with a code.
  • Sorry for my english. What I wanted to tell was: If it is not feasable to decrypt in firmware due to CPU capacity as you mentioned before, I can try a middle-software like the one 3DPrinterOS or Authentise uses which streams Gcode to the Printer directly. The encrypted code will be decrypted by my middle-software running on Windows or Rasp. pi and the gcode will be sent to printer via USB(serial in fact). To do so, I need to understand how Repetier Protocol Works. I already read the github docs about the protocol but it didn't help me so far. Thank you for your patience and support !



  • Yes, the middleware solution would be a solution to protect data until it gets send to printer. There of course it could be catched and copied. That would require writing your own host that gets such data and sends it.

    The repetier protocol sends data in binary format, but firmware also accepts data send as ascii if you like that more. See GCode.cpp on how it gets parsed. It is just a bitfield indicating which values (Letters) are included and then they follow in binary format and at the end 2 byte checksum (fletchers checksum).

    Thats all I can tell to this. 
Sign In or Register to comment.