diff options
author | alpaylan | 2021-04-16 15:31:48 +0300 |
---|---|---|
committer | alpaylan | 2021-04-16 15:31:48 +0300 |
commit | d9bd31d24d248e0923d08ac02252ec5c0b77a50c (patch) | |
tree | 34033b88f5979411cbec5c410030786ad5a78968 /site/public/register-docs | |
parent | 10e424b775bcf60c91710486b292fc91dba4fcc9 (diff) | |
parent | 20609a19fdb7fb1a81db77233858cf229b57465c (diff) | |
download | gradecoin-d9bd31d24d248e0923d08ac02252ec5c0b77a50c.tar.gz gradecoin-d9bd31d24d248e0923d08ac02252ec5c0b77a50c.tar.bz2 gradecoin-d9bd31d24d248e0923d08ac02252ec5c0b77a50c.zip |
Merge remote-tracking branch 'origin/main'
# Conflicts:
# site/public/search_index.en.js
Diffstat (limited to 'site/public/register-docs')
-rw-r--r-- | site/public/register-docs/index.html | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/site/public/register-docs/index.html b/site/public/register-docs/index.html index 810f4ec..9d9c91d 100644 --- a/site/public/register-docs/index.html +++ b/site/public/register-docs/index.html | |||
@@ -27,6 +27,7 @@ | |||
27 | <link rel="stylesheet" href="https://gradecoin.xyz/juice.css"> | 27 | <link rel="stylesheet" href="https://gradecoin.xyz/juice.css"> |
28 | 28 | ||
29 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" /> | 29 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" /> |
30 | <link rel="stylesheet" href="/site.css" /> | ||
30 | 31 | ||
31 | </head> | 32 | </head> |
32 | 33 | ||
@@ -76,6 +77,16 @@ | |||
76 | </div> | 77 | </div> |
77 | 78 | ||
78 | 79 | ||
80 | <div class="toc-item-child"> | ||
81 | <a class="subtext" href="https://gradecoin.xyz/register-docs/#cipher-initialization"><small>- Cipher Initialization</small></a> | ||
82 | </div> | ||
83 | |||
84 | <div class="toc-item-child"> | ||
85 | <a class="subtext" href="https://gradecoin.xyz/register-docs/#encryption"><small>- Encryption</small></a> | ||
86 | </div> | ||
87 | |||
88 | |||
89 | |||
79 | </div> | 90 | </div> |
80 | </div> | 91 | </div> |
81 | 92 | ||
@@ -87,7 +98,7 @@ | |||
87 | <p>POST request to <code>/register</code> endpoint</p> | 98 | <p>POST request to <code>/register</code> endpoint</p> |
88 | <p>Lets a user to authenticate themselves to the system. | 99 | <p>Lets a user to authenticate themselves to the system. |
89 | Only people who are enrolled to the class can open Gradecoin accounts. | 100 | Only people who are enrolled to the class can open Gradecoin accounts. |
90 | This is enforced with your Student ID and a one time password you will receive.</p> | 101 | This is enforced with your Student ID (e123456) and a one time password you will receive.</p> |
91 | <h1 id="authentication-process">Authentication Process</h1> | 102 | <h1 id="authentication-process">Authentication Process</h1> |
92 | <blockquote> | 103 | <blockquote> |
93 | <p>The bytes you are sending over the network are all Base64 Encoded</p> | 104 | <p>The bytes you are sending over the network are all Base64 Encoded</p> |
@@ -102,13 +113,26 @@ This is enforced with your Student ID and a one time password you will receive.< | |||
102 | "</span><span style="color:#009854;">passwd</span><span style="color:#545052;">": "</span><span style="color:#009854;">15 char secret</span><span style="color:#545052;">", | 113 | "</span><span style="color:#009854;">passwd</span><span style="color:#545052;">": "</span><span style="color:#009854;">15 char secret</span><span style="color:#545052;">", |
103 | "</span><span style="color:#009854;">public_key</span><span style="color:#545052;">": "</span><span style="color:#009854;">---BEGIN PUBLIC KEY...</span><span style="color:#545052;">" | 114 | "</span><span style="color:#009854;">public_key</span><span style="color:#545052;">": "</span><span style="color:#009854;">---BEGIN PUBLIC KEY...</span><span style="color:#545052;">" |
104 | } | 115 | } |
105 | </span></code></pre> | 116 | </span></code></pre><h2 id="cipher-initialization">Cipher Initialization</h2> |
117 | <blockquote> | ||
118 | <p>Since we are working with AES-128, both key and IV should be 128 bits (or 16 hexadecimal characters)</p> | ||
119 | </blockquote> | ||
106 | <ul> | 120 | <ul> |
107 | <li>Pick a short temporary key (<code>k_temp</code>)</li> | 121 | <li>Pick a short temporary key (<code>k_temp</code>)</li> |
108 | <li>Pick a random IV (<code>iv</code>).</li> | 122 | <li>Pick a random IV <a href="https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Initialization_vector_(IV)">1</a> <a href="https://en.wikipedia.org/wiki/Initialization_vector">2</a> (<code>iv</code>).</li> |
109 | <li>Encrypt the serialized string of <code>P_AR</code> with 128 bit block AES in CBC mode with Pkcs7 padding using the temporary key (<code>k_temp</code>), the result is <code>C_AR</code>. Encode this with base64.</li> | 123 | </ul> |
110 | <li>The temporary key you have picked <code>k_temp</code> is encrypted using RSA with OAEP padding scheme using SHA-256 with <code>gradecoin_public_key</code>, giving us <code>key_ciphertext</code>. Encode this with base64.</li> | 124 | <h2 id="encryption">Encryption</h2> |
125 | <ul> | ||
126 | <li>Encrypt the serialized string of <code>P_AR</code> with 128 bit block <a href="https://en.wikipedia.org/wiki/Initialization_vector">AES</a> in <a href="https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#CBC">CBC</a> mode with <a href="https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Padding">Pkcs7 padding</a> using the temporary key (<code>k_temp</code>), the result is <code>C_AR</code>. Encode this with base64.</li> | ||
127 | <li>The temporary key you have picked <code>k_temp</code> is encrypted using RSA with <a href="https://en.wikipedia.org/wiki/Optimal_asymmetric_encryption_padding">OAEP</a> padding scheme using SHA-256 with <code>gradecoin_public_key</code>, giving us <code>key_ciphertext</code>. Encode this with base64.</li> | ||
111 | <li>Base64 encode the IV (<code>iv</code>) as well.</li> | 128 | <li>Base64 encode the IV (<code>iv</code>) as well.</li> |
129 | </ul> | ||
130 | <blockquote class="tidbit"> | ||
131 | <p> | ||
132 | The available tools and libraries might warn you about how using the primitives given above are "hazardous". They are, crypto is hard. | ||
133 | </p> | ||
134 | </blockquote> | ||
135 | <ul> | ||
112 | <li>The payload JSON object (<code>auth_request</code>) can be serialized now:</li> | 136 | <li>The payload JSON object (<code>auth_request</code>) can be serialized now:</li> |
113 | </ul> | 137 | </ul> |
114 | <pre style="background-color:#ffffff;"> | 138 | <pre style="background-color:#ffffff;"> |
@@ -119,7 +143,7 @@ This is enforced with your Student ID and a one time password you will receive.< | |||
119 | } | 143 | } |
120 | </span></code></pre> | 144 | </span></code></pre> |
121 | <p>If your authentication process was valid, you will be given access and your public key fingerprint that is your address. | 145 | <p>If your authentication process was valid, you will be given access and your public key fingerprint that is your address. |
122 | You can now sign JWTs to send authorized transaction requests.</p> | 146 | You can now sign <a href="https://gradecoin.xyz/jwt/">JWTs</a> to send authorized transaction requests.</p> |
123 | 147 | ||
124 | 148 | ||
125 | </div> | 149 | </div> |