Hello 0x00sec,
In the following I want to give you an idea of the inner workings of a protocol that I’m currently developing.
First and foremost I’m looking for feedback. I’m not sure in how fare anyone has experience in something like this but at least you likely know how to break it - so I get ideas on how to improve it.
In the past days I’ve been working on an idea for my project.
For the project, a web platform, I wanted to be familiar with object oriented PHP, which I will use for an essential part of it.
The general architecture of the platform is based on three levels:
- I/O Level
- Processing Level
- Data Core
As I have a lot of different modules interacting/communicating with each other, I wanted to create a standardized way how they communicate.
The idea of a protocol was born.
I called it SXP - for two reason:
- It sounds flashy!
- The platform is called “SCARDA”, thus Scarda Exchange Protocol
The general concept of the protocol packet is quite easy:
*----------------*
| HEADER |
*----------------*
| HASH |
*----------------*
| |
| BODY / |
| PAYLOAD |
| |
*----------------*
The HEADER
contains four elements:
*--------------------*
| DESTINATION DEPT. |
*--------------------*
| DESTINATION DIV. |
*--------------------*
| SOURCE DEPT. |
*--------------------*
| SOURCE DIV. |
*--------------------*
Whereas all information in the HEADER
are represented by integers:
DESTINATION DEPT.
'--> General Branch of Destination (what kind of module is it? Processing, Query etc.)
DESTINATION DIV.
'--> Specific module, such as a certain analysis module
Same goes for the SOURCE
So, the HEADER
tells about the WHERE:
- Where is the packet going?
- Where does it come from?
Now comes the interesting part:
Next section of the packet is the HASH
.
I wanted to have a self-validating protocol that makes sure only the right information is transferred to the right place. So I came up the a basic idea:
When information is ready to be sent off, the SOURCE
sends its HEADER
to the
IVM = Internal Validation Module
Then the following process takes place:
- The
IVM
reads theHEADER
.- It creates a random
SHA512 HASH
(10 digit random integer to SHA512).
2.5 This happens everytime a packet sends itsHEADER
to the IVM, so each transfer has a uniqueHASH
.- It sends the
SOURCE
information (two integers) and theHASH
to theDESTINATION
.- At
DESTINATION
the information is put on aSTACK / QUEUE
.- The
IVM
then sends the sameHASH
to theSOURCE
.- The
SOURCE
adds theHASH
to theHEADER
and loads on thePAYLOAD
, here calledBODY
.- Once ready to go, the packet is send to the
DESTINATION
.- At
DESTINATION
the packet is going to theSTACK
, where the actual validation happens when theHASHES
are compared.- If packet and stack have the same
HASH
, the packet is allowed to unload its data at theDESTINATION
.
Each module is SOURCE
and DESTINATION
at the same time(except those on I/O level) so all modules can communicate with each other.
So far, that’s it.
Tthis was basically just for fun as I wanted to do something to learn OOP in PHP and didn’t want to feel miserable when failing at the actual task, the backend of the platform.
However, I had two more ideas about it:
Transferring this concept on the internet, where a server (?) might act as the IVM, sending those hashes to the connecting parties
Transferring this concept to the very core of an OS
Both could be combined with a decent encryption as well to make it almost impossible to capture/infiltrate the stream of data.
As mentioned at the very beginning, I’m looking forward to feedback in any form!
Cheers