Kaynağa Gözat

V1 changes

master
Ludovic 'Archivist' Lagouardette 5 yıl önce
ebeveyn
işleme
e39325bf02
10 değiştirilmiş dosya ile 575 ekleme ve 128 silme
  1. +4
    -0
      .gitignore
  2. +2
    -2
      .vscode/settings.json
  3. +76
    -0
      V1/Makefile
  4. +80
    -0
      V1/include/endian.hpp
  5. +0
    -0
      V1/src/db_stats.cpp
  6. +0
    -0
      V1/src/izaro-storage.cpp
  7. +24
    -0
      V1/src/modules/exceptions_helpers.cppm
  8. +169
    -0
      V1/src/modules/fmap.cppm
  9. +1
    -1
      gplib
  10. +219
    -125
      whitepaper/main.tex

+ 4
- 0
.gitignore Dosyayı Görüntüle

@ -1,4 +1,6 @@
*.orig
*.pcm
*.o
build/*
vgcore.*
whitepaper/main.aux
@ -22,3 +24,5 @@ whitepaper/main.run.xml
whitepaper/main.toc
whitepaper/main.synctex.gz
whitepaper/main.pdf
whitepaper/main.dvi
whitepaper/main.out.ps

+ 2
- 2
.vscode/settings.json Dosyayı Görüntüle

@ -1,7 +1,7 @@
{
"clang.cxxflags": [
"-I${workspaceRoot}/include",
"-I${workspaceRoot}/V1/include",
"-I${workspaceRoot}/CommandEr/src",
"--std=c++17"
"--std=c++2a"
]
}

+ 76
- 0
V1/Makefile Dosyayı Görüntüle

@ -0,0 +1,76 @@
#
# **************************************************************
# * Simple C++ Makefile Template *
# * *
# * Author: Arash Partow (2003) *
# * URL: http://www.partow.net/programming/makefile/index.html *
# * *
# * Copyright notice: *
# * Free use of this C++ Makefile template is permitted under *
# * the guidelines and in accordance with the the MIT License *
# * http://www.opensource.org/licenses/MIT *
# * *
# **************************************************************
#
#
# Modifications of the original file are licenced under MIT Licence
#
#(c) Ludovic 'Archivist' Lagouardette 2018
#
CXX := -clang++
DEBUG := -g -O0 -DUNITTEST
RELEASE := -s -O3 -fno-rtti
CXXFLAGS := $(RELEASE) -Wno-unknown-warning-option -Wno-address-of-packed-member -pedantic-errors -Wall -Wextra -Werror -Wfatal-errors -std=c++2a -m64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fmodules-ts
LDFLAGS := -L/usr/lib
BUILD := build
OBJ_DIR := $(BUILD)/objects
MOD_DIR := $(BUILD)/modules
APP_DIR := $(BUILD)/apps
TARGET := izaro-storage.cpp
INCLUDE := -Iinclude/ -I../CommandEr/src -I../json/single_include -I../tiny-js/
SRC := \
MODULES := $(wildcard modules/*.cpp)
CMODULES := $(MODULES:%.cpp=$(MOD_DIR)/%.pcm)
OMODULES := $(MODULES:%.cpp=$(MOD_DIR)/%.o)
TJS_SRC :=
#pool_allocator.cpp TinyJS.cpp TinyJS_Functions.cpp TinyJS_MathFunctions.cpp TinyJS_StringFunctions.cpp TinyJS_Threading.cpp
TJS_OBJECTS := $(TJS_SRC:%.cpp=$(OBJ_DIR)/%.tjs.o)
OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o) ../CommandEr/build/commander.o
TEST_OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.test.o)
TARGETNAME := $(TARGET:%.cpp=%)
all: build $(TARGET)
$(MOD_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -fmodules-ts --precompile $< -o $(OMODULES:$(MOD_DIR)/%.o=$(MOD_DIR)/%.pcm)
$(CXX) $(CXXFLAGS) -fmodules-ts -c $(OMODULES:$(MOD_DIR)/%.o=$(MOD_DIR)/%.pcm) -o $@
$(TARGET): $(OBJECTS) build
make -C ../CommandEr
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -pthread $(INCLUDE) $(LDFLAGS) -o $(APP_DIR)/$(TARGETNAME) src/$(TARGET) $(OBJECTS) $(TJS_OBJECTS)
.PHONY: all build clean
ASTYLE_FLAGS= --style=stroustrup --align-reference=type --align-pointer=type --break-blocks \
--indent-namespaces --indent=tab --add-brackets
format:
astyle $(ASTYLE_FLAGS) include/*
astyle $(ASTYLE_FLAGS) src/*
build:
@mkdir -p $(APP_DIR)
@mkdir -p $(OBJ_DIR)
clean:
rm -rf build/*
rm -rf src/*.orig
rm -rf include/*.orig

+ 80
- 0
V1/include/endian.hpp Dosyayı Görüntüle

@ -0,0 +1,80 @@
#pragma once
#include <stdint.h>
#include <stddef.h>
#include <array>
#include <algorithm>
#if __cplusplus <= 201703L
namespace _hidden{
enum class endian
{
#ifdef _WIN32
little = 0,
big = 1,
native = little
#else
little = __ORDER_LITTLE_ENDIAN__,
big = __ORDER_BIG_ENDIAN__,
native = __BYTE_ORDER__
#endif
};
}
namespace bitops{
using endian = _hidden::endian;
}
#else
#include <type_traits>
namespace bitops{
using endian = std::endian;
}
#endif
namespace bitops{
template<typename T, size_t sz = sizeof(T)>
constexpr std::array<uint8_t,sizeof(T)> swap_if_little_raw(T xsz)
{
std::array<uint8_t,sizeof(T)> ret = {0};
auto abstract = (std::array<uint8_t,sizeof(T)>*)&xsz;
if constexpr (endian::native == endian::little)
{
std::copy(abstract->rbegin(), abstract->rend(), ret.begin());
}
else
{
std::copy(abstract->begin(), abstract->end(), ret.begin());
}
return ret;
}
template<typename T, size_t sz = sizeof(T)>
constexpr T swap_if_little(T xsz)
{
auto tmp = swap_if_little_raw(xsz);
return *(T*)&tmp;
}
template<typename T>
struct [[gnu::packed]] regulated{
T internal = 0;
constexpr regulated(T value)
: internal{swap_if_little(value)}
{ }
constexpr void operator=(T value)
{
internal = swap_if_little(value);
}
constexpr void operator+=(const int& v)
{
internal = swap_if_little(T(*this)+v);
}
constexpr operator T() const {
return swap_if_little(internal);
}
};
}

+ 0
- 0
V1/src/db_stats.cpp Dosyayı Görüntüle


+ 0
- 0
V1/src/izaro-storage.cpp Dosyayı Görüntüle


+ 24
- 0
V1/src/modules/exceptions_helpers.cppm Dosyayı Görüntüle

@ -0,0 +1,24 @@
export module exceptions_helpers;
import _Builtin_stddef_max_align_t;
extern "C" {
#include <errno.h>
}
#include <exception>
#include <string>
export struct errno_exception : public std::runtime_error {
errno_exception(int err)
: runtime_error{std::string{"errno with value "}+std::to_string(err)}
{}
};
export void throw_errno_if(bool pred)
{
if(pred)
{
throw errno_exception{errno};
}
}

+ 169
- 0
V1/src/modules/fmap.cppm Dosyayı Görüntüle

@ -0,0 +1,169 @@
export module fmap;
import <string>;
import <iostream>;
import <atomic>;
import exceptions_helpers;
#include <stdint.h>
#include <endian.hpp>
#include <assert.h>
// Unix-y stuff
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
namespace archivist{
export using fmap_opt_value = uint32_t;
export enum class fmap_options : fmap_opt_value {
random_access = MADV_RANDOM,
sequence_access = MADV_SEQUENTIAL,
will_need = MADV_WILLNEED,
#ifdef MADV_DONTDUMP
no_dump = MADV_DONTDUMP,
#endif
};
inline namespace conversions {
export constexpr fmap_opt_value operator fmap_opt_value(fmap_options opt) {
return (fmap_opt_value)opt;
}
}
export constexpr size_t page_size = 4096;
export class region_ptr {
std::atomic_int* ref_count;
public:
void* region;
size_t len;
region()
noexcept
: ref_count{nullptr}
, region{nullptr}
, len{0}
{}
region_ptr (
const size_t length,
const int prot,
const int flags,
const int fd,
const off_t offset
)
noexcept(false)
: ref_count{new std::atomic_int(1)}
{
auto mmap_ret = mmap(nullptr, length, prot, flags, fd, offset);
throw_errno_if(mmap_ret==MAP_FAILED);
region = mmap_ret;
len = length;
}
region_ptr(const region_ptr& oth)
noexcept
: ref_count(oth.ref_count)
, region(oth.region)
, len(oth.len)
{
ref_count->fetch_add(1);
}
~region_ptr()
{
if(!ref_count || !region)
return;
auto v = ref_count->fetch_sub(1);
if(v==1)
{
delete ref_count;
munmap(region, length);
}
}
bool operation bool()
noexcept
{
return region && ref_count && len;
}
}
export using open_opt_flags = int;
export enum class open_options : open_opt_flags {
append = O_APPEND,
create = O_CREAT,
async = O_ASYNC,
direct = O_DIRECT,
data_sync = O_DSYNC,
file_sync = O_SYNC,
exclusive = O_EXCL,
no_access_time = O_NOATIME,
no_follow = O_NOFOLLOW,
temporary = O_TEMP,
truncate = O_TRUC
};
export using open_opt_mode = int;
export enum class open_modes : open_opt_mode {
user_read = S_IRUSR,
user_write = S_IWUSR,
user_exec = S_IXUSR,
group_read = S_IRGRP,
group_write = S_IWGRP,
group_exec = S_IXGRP,
other_read = S_IROTH,
other_write = S_IWOTH,
other_exec = S_IXOTH,
set_uid = S_ISUID,
set_gid = S_ISGID,
sticky_bit = S_ISVTX
};
inline namespace conversions {
export constexpr open_opt_flags operator open_opt_flags(open_options opt) {
return (open_opt_flags)opt;
}
export constexpr open_opt_mode operator open_opt_mode(open_modes opt) {
return (open_opt_mode)opt;
}
}
export class abstract_fd {
std::atomic_int* ref_count;
int fd = 0;
public:
abstract_fd(const std::string& pathname, open_opt_flags flags, mode_t mode)
{
}
int operator int() {
if(!fd) throw std::runtime_error("reading a closed fd");
return fd;
}
}
export template<typename T>
class farray_ptr {
region_ptr ptr;
public:
farray_ptr(const std::string& file)
{
}
};
}

+ 1
- 1
gplib

@ -1 +1 @@
Subproject commit d4eeda2112f6faca40e05218c1c87610e40a6f9d
Subproject commit 2cbc1cc134a7273f0048f4074101f13b0512f6bf

+ 219
- 125
whitepaper/main.tex Dosyayı Görüntüle

@ -106,7 +106,7 @@
\noindent \textsc{https://archivist.nekoit.xyz}\\ % URL
\noindent This document is under intellectual property of NekoIT, reproduction is allowed in digital format only.\\ % License information, replace this with your own license (if any)
\noindent This document is under intellectual property of NekoIT, reproduction and redistribution is allowed in digital format only without any modifications.\\ % License information, replace this with your own license (if any)
\noindent \textit{First printing, 2019} % Printing/edition date
@ -239,6 +239,8 @@ Ovh rented servers $\times 4$ & USD890/m & USD0.21 & 0 \\\hline
\label{tab:server_pricing}
\end{table}
As the table \autoref{tab:server_pricing} expresses, buying hardware in 2019 is not as efficient as renting servers if you do not have the ability to host your servers in your own premises.
\subsection{Brand new hardware}
Brand new hardware is generally a real investment for an individual or a new company. It is also a technical choice that can have lifelong consequences on the business as computers are subdivided in families that each have specific features and behaviours.
@ -461,7 +463,7 @@ We want to provide an online storage with the following properties:
\vspace{0.3em}Finally, it must be flexible and adaptable to multiple use-cases.
\vspace{1em}This leads us to the following idea: we are aiming to create a service that can store encrypted data, it must be able to store it in a layout similar to a disk, this way it possesses the same capabilities as a hard drive disk. The key to decrypt the data is stored online but encrypted with the user password. Authentication requires the user to be able to read the password to get a token. It is possible to leave said token disabled and enable it only with a second authentication factor.
\vspace{1em}This leads us to the following idea: we are aiming to create a service that can store encrypted data, it must be able to store it in a layout similar to a disk, this way it possesses the same capabilities as a hard drive disk. The key to decipher the data is stored online but encrypted with the user password. Authentication requires the user to be able to read the password to get a token. It is possible to leave said token disabled and enable it only with a second authentication factor.
We want our system to be protected from the point of view of our customers, as such, we aim at it having a code-base readable and short enough to be explored completely in 3 days by a developer with access to enough documentation.
@ -475,7 +477,7 @@ Our project aim to follow the following principles:
\item Principle of openness: we aim to disclose any incident that may happen, and to disclose any request by officials to access anyone's data.
\end{itemize}
The principle of least knowledge is upheld in the very design of the system: only the user can make sense of the address space of both the file system and block device. To provide an analogy, the data is stored in multiple boxes. The user side software randomly labels the boxes and seal them (that seal is the encryption). If you store data that overflows from one box, you will store in multiple boxes. Decrypting any data requires to know which box is the first one and which is the next one, but that very piece of information is not stored on the server: it is stored in one of the sealed boxes.
The principle of least knowledge is upheld in the very design of the system: only the user can make sense of the address space of both the file system and block device. To provide an analogy, the data is stored in multiple boxes. The user side software randomly labels the boxes and seal them (that seal is the encryption). If you store data that overflows from one box, you will store in multiple boxes. deciphering any data requires to know which box is the first one and which is the next one, but that very piece of information is not stored on the server: it is stored in one of the sealed boxes.
Furthermore, the labels of each block of data can be used as a piece of the encryption process, this is an example of the principle of greater usage: any additional information that can help make the system safer, we will use it.
@ -512,12 +514,53 @@ Here is a list of the data that may be collected by us in any interaction with o
\chapter{A personal view on business practices}
\vspace{-5em}
\begin{center}
{\tiny This chapter expresses the view of the author of both this documentation and the software associated with it and only of him.}
\end{center}
\vspace{5em}
\vspace{-3em}\hspace{-1.4em}On the internet, we encounter a huge variety of businesses and of company cultures. We also encounter a just as huge variety of bad business practices.
As a person with peculiar ways to see good and bad, I will say that is actively doing things that may be hurtful to a customer or have dire consequences to them as bad.
\section{On selling the user}
For some companies, users are the resource that they sell to gain their money. I would like to put down 3 forms of business just after that sentence:
\begin{enumerate}
\item Companies that sell products and services
\item Companies that showcase or regroup other products and services of other companies and sell them
\item Companies that provide a service to someone for free in exchange for their personal information in order to sell said information to other companies
\end{enumerate}
I think it is fairly easy to see how a user could be troubled by the idea that the service they are providing them is a honeypot for advertisement information. I make a difference between that and providing advertisement to user of one's platform in the idea that they are providing information to their users (advertisements) but not selling the information of any individual user of their platform, putting it akin to advertisements on television or on cars.
I see two issues in selling personal information from users \emph{even if they signed a contract to agree you do} and first is that users do not know to who their personal information has been exchanged with; in short, they lose control of their privacy. Coming from a country where keeping video protection records for more than necessary is illegal and where one can forbid companies from using their phone number for any kind of communications, I was raised in the idea you are free to exchange your own personal information but not anyone's else.
This leaves you master of your information at all times.
The second problem is a moral one, and it is double. First, their user is a product, no longer so much of a human. This means that more than respecting them as individuals, you have to get a lot of them to create a significant revenue. Then, it is about how explicit companies that do that kind of model inform their users of the way their model works and on the alternatives to having your data sold they do provide, which are generally nonexistent.
I do understand people would be willing to sell their data for a service free of charges, It should be understandable people would also be willing to have that service and pay for it to be in a situation where their data is not sold to third parties.
\section{On misrepresenting the invisible}
\autocite{apple_sweatshop}
Some companies are proud to showcase their service/products as a first class services/products, whenever it is customer support or products, while it is actually third-world exploitation or exploiting illegal immigrants\autocite{apple_sweatshop}.
No need to present any details on morals implications on lies and of employing low qualification labor for as cheap as it is possible. I will focus on how bad that is for your customers. First of all, under-qualified labor is very likely to provide wrong advice for products or to be very under performing providing a service, not to mention building or assembling any sort of products.
Some also present their products like they are so advanced they are magical while they actually provide very few added value.
\vspace{1em}On this side is also the representation of the mythical beast named the Cloud. People tend to represent it to themselves as their data stored in some imaginary location, as it effectively can be anywhere in the world. Where a company could make sure data about a single customer is in a handful of their data centers so that they could say "your data is in located in our datacenter of \emph{name of the city} in \emph{name of the country}" it would make for a nice improvement.
\section{On practice of transparent business}
I think any level of openness of practices in a business is good. When you show the insides of your business and of how it works, I think it both bears trust and customers to you.
Companies with open business practices have in my opinion the greatest chance of surviving for a long time and to avoid scandal. I think it can be as open as presenting the cost of the products sliced by its components and margin to the customers. This brings a relationship of trust between the business and its customer, making the business more capable of actually changing the price of their products given changes of the cost they incur to make them.
\part{Functional specification}
@ -851,115 +894,13 @@ Behaviour of the login part of the page is expected to be identical to the behav
\part{Technical specification}
\chapter{Storage layer}
\section{\texttt{izaro-storage}}
\section{\texttt{db\_{}stats}}
\chapter{Coordination layer}
\section{Client to \texttt{izaro-coordinate}}
\section{\texttt{izaro-coordinate} to \texttt{izaro-storage}}
\chapter{Time synchronization}
\section{Steadiness requirement}
\section{Storage side requirement}
\chapter{Client side}
\section{Key blocks and system root layout}
\section{Command line user interface}
\section{Graphical user interface}
\chapter{Block storage system}
\chapter{Native file system}
\appendix
\part{Annexes}
%\setcounter{chapter}{1}
%\renewcommand\thechapter{\Alph{chapter}}
\chapter{Encryption popularized}
\label{annex:encryption_popularized}
\textbf{Encryption: }The act to transform a message into a random looking cipher-text. The original message is often named the plain-text.
\hspace{-1.4em}\textbf{Cipher: }The mathematical function that transforms a plain-text into a cipher-text
\vspace{1.5em}\hspace{-1.4em}Encrypting data can be done in various ways. Each way have its properties and its resistances to certain types of attacks. All modern cryptography is key-based cryptography. It means that the way we encrypt data is not secret, what is secret is a value, named the key, that is used to encrypt the data.
\section{Properties of encryption}
We will here explain some of the properties a cipher can hold.
\subsection{Resistance}
A cipher generally have its resistance expressed as a power of two (e.g.: $2^{103}$) or as a number of bits of entropy (e.g.: $103~bits$). It is to be noted that this scale is not linear: it is exponential.
This means that a cipher that have $104~bits$ of entropy is 2 times harder to break than one with a resistance of $103~bits$ of the same family. Comparing resistance between different families is not relevant.
\subsection{Compactness}
Compactness of a cipher means that if you encrypt a message of side $n$ you will obtain a cipher-text of the same size. Conversely, If a cipher can generates a longer cipher-text than its message, it is said to be not compact.
for example, let's consider a simple cipher: for a message $A$, read it as a number and multiply it with a value that will be the key.
If your message is for example 8 digits, like $00005555$ and the key is $12345678$, the cipher-text will be equal to $5555 \times 12345678 = 68580241290$ which make a 11 digits cipher-text from a 8 digit message.
\subsection{Homomorphism}
Homomorphism means that for a message $A$ and an operation $f : x$ (for example, if $f : x \rightarrow x \times 2$ means the operation of multiplying by 2), if you apply a cipher to $A$ and get a cipher-text $B$, there exist a way to apply $f : x$ to $B$ in such a way that decryption of $B$ gives you the result of applying $f : x$ to $A$.
Expressed more simply, it means the you can execute operations on encrypted data without requiring to decipher it or understand it. Very few encryption mechanisms are fully homomorphic and those are mostly in research\autocite{Gentry:2009:FHE:1834954}.
\section{Types of encryption}
Encryption can express itself in different forms regarding to its way to handle the cryptographic key. Some have only one key, that must be known for encrypting and decrypting the data, we call those symmetrical ciphers; some have two keys, one for encrypting and one for decrypting, we call those asymmetrical ciphers.
\subsection{Symmetrical encryption}
\begin{figure}[h]
\begin{center}
\begin{itemize}
\item AES
\item Chacha20
\item Blowfish
\item Serpent
\item Twofish
\item CAST5
\item RC4
\item DES
\item 3DES
\item Skipjack
\item IDEA
\end{itemize}
\end{center}
\caption{List of symmetrical ciphers}
\label{fig:sym_ciphers}
\end{figure}
\subsection{Asymmetrical encryption}
\begin{figure}[h]
\begin{center}
\begin{itemize}
\item Prime numbers based (RSA)
\item Elliptic curve based (ECDSA)
\item Paillier crypto system
\item Lattice based (NTRU, BLISS\autocite{Gentry:2009:FHE:1834954})
\end{itemize}
\end{center}
\caption{List of asymmetrical ciphers}
\label{fig:asym_ciphers}
\end{figure}
\chapter{Protocols}
\section{\texttt{izaro-storage} queries}
\begin{figure}[h!]
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=1.06em, bitformatting={\tiny\ttfamily}]{32}
\begin{bytefield}[bitwidth=1.06em, bitformatting={\tiny\ttfamily}]{32}
\bitheader{0-31} \\
\bitbox{14}{\texttt{unused}}
\bitbox{1}{\texttt{\footnotesize 2S}}
@ -976,7 +917,7 @@ Encryption can express itself in different forms regarding to its way to handle
\label{fig:common_format_storage}
\end{figure}
\begin{figure}
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=1.06em]{32}
@ -992,7 +933,7 @@ Encryption can express itself in different forms regarding to its way to handle
\label{fig:record_identifier}
\end{figure}
\begin{figure}
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=0.48em, bitformatting={\tiny\ttfamily}]{64}
@ -1008,7 +949,7 @@ Encryption can express itself in different forms regarding to its way to handle
\label{fig:read_format_storage}
\end{figure}
\begin{figure}
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=0.46em, bitformatting={\tiny\ttfamily}]{64}
@ -1029,7 +970,7 @@ Encryption can express itself in different forms regarding to its way to handle
\label{fig:write_format_storage}
\end{figure}
\begin{figure}
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=0.48em, bitformatting={\tiny\ttfamily}]{64}
@ -1045,7 +986,7 @@ Encryption can express itself in different forms regarding to its way to handle
\label{fig:confirm_format_storage}
\end{figure}
\begin{figure}
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=0.48em, bitformatting={\tiny\ttfamily}]{64}
@ -1063,7 +1004,7 @@ Encryption can express itself in different forms regarding to its way to handle
\begin{figure}
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=1.06em, bitformatting={\tiny\ttfamily}]{32}
@ -1082,9 +1023,50 @@ Encryption can express itself in different forms regarding to its way to handle
\label{fig:bulk_read_format_storage}
\end{figure}
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=1.06em]{32}
\bitheader{0,31} \\
\wordbox{4}{\texttt{Common request format (storage)}} \\
\bitbox{32}{IP address}\\
\bitbox{16}{UDP port}
\bitbox[lrt]{16}{} \\
\bitbox[lr]{32}{Timestamp} \\
\bitbox[lrb]{16}{}
\bitbox[t]{16}{} \\
\end{bytefield}
\begin{itemize}
\item[] The time is the time for which data labeled at any time before won't be sent
\end{itemize}
\caption{Stream writer query}
\label{fig:stream_writes_request}
\end{figure}
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=1.06em]{32}
\bitheader{0,31} \\
\wordbox{4}{\texttt{Common request format (storage)}} \\
\bitbox{16}{\texttt{UDP port}}
\bitbox[lrt]{16}{} \\
\bitbox[lr]{32}{\texttt{Timestamp}} \\
\bitbox[lrb]{16}{}
\bitbox{1}{\texttt{N}}
\bitbox{15}{\texttt{Unused}} \\
\end{bytefield}
\begin{itemize}
\item[-] The time is the time for which data labeled at any time before won't be written
\end{itemize}
\texttt{N}: if this flag is set, instead of ignoring data that is before the limit, it will only keep the latest version of that data
\caption{Stream reader query}
\label{fig:stream_reads_request}
\end{figure}
\section{\texttt{izaro-storage} replies}
\begin{figure}[h!]
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=0.48em, bitformatting={\tiny\ttfamily}]{64}
@ -1104,7 +1086,7 @@ Encryption can express itself in different forms regarding to its way to handle
\label{fig:record_storage}
\end{figure}
\begin{figure}[h]
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=0.48em, bitformatting={\tiny\ttfamily}]{64}
@ -1127,7 +1109,7 @@ Encryption can express itself in different forms regarding to its way to handle
\label{fig:common_format_reply_storage}
\end{figure}
\begin{figure}[h!]
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=0.48em, bitformatting={\tiny\ttfamily}]{64}
@ -1160,7 +1142,7 @@ Encryption can express itself in different forms regarding to its way to handle
\section{\texttt{izaro-coordinate} queries}
\begin{figure}[h]
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=0.48em]{64}
@ -1185,7 +1167,7 @@ Encryption can express itself in different forms regarding to its way to handle
\subsection{User payloads}
\begin{figure}[h]
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=0.48em]{64}
@ -1202,7 +1184,7 @@ Encryption can express itself in different forms regarding to its way to handle
\label{fig:read_request}
\end{figure}
\begin{figure}[h]
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=0.48em]{64}
@ -1222,12 +1204,13 @@ Encryption can express itself in different forms regarding to its way to handle
\subsection{Root user payloads}
\section{\texttt{izaro-coordinate} replies}
\begin{figure}[h]
\begin{figure}[H]
\centering
\begin{bytefield}[bitwidth=0.48em]{64}
\bitheader{0,31,63} \\
\wordbox{1}{\texttt{page count}} \\
\wordbox{3}{\texttt{page max}} \\
@ -1243,7 +1226,7 @@ Encryption can express itself in different forms regarding to its way to handle
\section{\texttt{izaro-coordinate} timing protocol and consensus}
\begin{figure}[h]
\begin{figure}[H]
\centering
\begin{sequencediagram}
\newthread{a}{: Client}
@ -1256,7 +1239,7 @@ Encryption can express itself in different forms regarding to its way to handle
\label{fig:time_proto}
\end{figure}
\begin{figure}[h]
\begin{figure}[H]
\centering
\begin{sequencediagram}
\newthread{a}{: Client \#1}
@ -1276,7 +1259,7 @@ Encryption can express itself in different forms regarding to its way to handle
\label{fig:confirmation_proto}
\end{figure}
\begin{figure}[h]
\begin{figure}[H]
\centering
\begin{footnotesize}
\begin{sequencediagram}
@ -1322,6 +1305,117 @@ Encryption can express itself in different forms regarding to its way to handle
\label{fig:2user_confirmation_proto}
\end{figure}
\chapter{Storage layer}
\section{\texttt{izaro-storage}}
\section{\texttt{db\_{}stats}}
\chapter{Coordination layer}
\section{Client to \texttt{izaro-coordinate}}
\section{\texttt{izaro-coordinate} to \texttt{izaro-storage}}
\chapter{Time synchronization}
\section{Steadiness requirement}
\section{Storage side requirement}
\chapter{Client side}
\section{Key blocks and system root layout}
\section{Command line user interface}
\section{Graphical user interface}
\chapter{Block storage system}
\chapter{Native file system}
\appendix
\part{Annexes}
%\setcounter{chapter}{1}
%\renewcommand\thechapter{\Alph{chapter}}
\chapter{Encryption popularized}
\label{annex:encryption_popularized}
\textbf{Encryption: }The act to transform a message into a random looking cipher-text. The original message is often named the plain-text.
\hspace{-1.4em}\textbf{Cipher: }The mathematical function that transforms a plain-text into a cipher-text
\vspace{1.5em}\hspace{-1.4em}Encrypting data can be done in various ways. Each way have its properties and its resistances to certain types of attacks. All modern cryptography is key-based cryptography. It means that the way we encrypt data is not secret, what is secret is a value, named the key, that is used to encrypt the data.
\section{Properties of encryption}
We will here explain some of the properties a cipher can hold.
\subsection{Resistance}
A cipher generally have its resistance expressed as a power of two (e.g.: $2^{103}$) or as a number of bits of entropy (e.g.: $103~bits$). It is to be noted that this scale is not linear: it is exponential.
This means that a cipher that have $104~bits$ of entropy is 2 times harder to break than one with a resistance of $103~bits$ of the same family. Comparing resistance between different families is not relevant.
\subsection{Compactness}
Compactness of a cipher means that if you encrypt a message of side $n$ you will obtain a cipher-text of the same size. Conversely, If a cipher can generates a longer cipher-text than its message, it is said to be not compact.
for example, let's consider a simple cipher: for a message $A$, read it as a number and multiply it with a value that will be the key.
If your message is for example 8 digits, like $00005555$ and the key is $12345678$, the cipher-text will be equal to $5555 \times 12345678 = 68580241290$ which make a 11 digits cipher-text from a 8 digit message.
\subsection{Homomorphism}
Homomorphism means that for a message $A$ and an operation $f : x$ (for example, if $f : x \rightarrow x \times 2$ means the operation of multiplying by 2), if you apply a cipher to $A$ and get a cipher-text $B$, there exist a way to apply $f : x$ to $B$ in such a way that decipherion of $B$ gives you the result of applying $f : x$ to $A$.
Expressed more simply, it means the you can execute operations on encrypted data without requiring to decipher it or understand it. Very few encryption mechanisms are fully homomorphic and those are mostly in research\autocite{Gentry:2009:FHE:1834954}.
\section{Types of encryption}
Encryption can express itself in different forms regarding to its way to handle the cryptographic key. Some have only one key, that must be known for encrypting and deciphering the data, we call those symmetrical ciphers; some have two keys, one for encrypting and one for deciphering, we call those asymmetrical ciphers.
\subsection{Symmetrical encryption}
Symmetrical encryption aims to encrypt data on a two way channel. The key allows you to both write encrypted data and read encrypted data, making it very suitable for securing a network channel once the keys have been safely exchanged, or to encrypt a disk.
\begin{figure}[h]
\begin{center}
\begin{itemize}
\item AES
\item Chacha20
\item Blowfish
\item Serpent
\item Twofish
\item CAST5
\item RC4
\item DES
\item 3DES
\item Skipjack
\item IDEA
\end{itemize}
\end{center}
\caption{List of symmetrical ciphers}
\label{fig:sym_ciphers}
\end{figure}
Symmetrical encryption also have the advantage that in some cases it is possible to interweave some amounts of the encrypted data together, making the data harder to decipher if a part of it is missing. This is especially used when encrypting data that is read sequentially like network data, but this feature is not suitable for encrypting data on a disk or on any random access media.
\subsection{Asymmetrical encryption}
The goal of asymmetrical encryption is to provide ways to authenticate messages, ways to encrypt a message with a key and decipher it with a different key, and more generally ways to exchange secrets.
\begin{figure}[h]
\begin{center}
\begin{itemize}
\item Prime factorization based (RSA)
\item Elliptic curve based (ECDSA)
\item Paillier crypto system
\item Lattice based (NTRU, BLISS\autocite{Gentry:2009:FHE:1834954})
\end{itemize}
\end{center}
\caption{List of asymmetrical ciphers}
\label{fig:asym_ciphers}
\end{figure}
It is evolving a lot nowadays as the most used algorithms are not extremely resistant to being deciphered by quantum mechanics based computers, in particular, systems based on the prime factor decomposition problem are hard to solve by typical computers but in theory not as hard by quantum computers.
This kind of cryptographic systems are generally used to exchange keys for symmetrical encryption.
\backmatter
%----------------------------------------------------------------------------------------

Yükleniyor…
İptal
Kaydet