aboutsummaryrefslogtreecommitdiffstats
path: root/site/public/register-docs
diff options
context:
space:
mode:
authoralpaylan2021-04-16 15:31:48 +0300
committeralpaylan2021-04-16 15:31:48 +0300
commit1495152ca8638c927c1588b844f65bb05e3f29a0 (patch)
tree089d9a73e1188ebfc3e2f23454d196597e46d82f /site/public/register-docs
parent93ae5dd8b67844b9f17904a1db6104780db25fcb (diff)
parent0f67c6c79325078ad71f666915c065d15d417814 (diff)
downloadgradecoin-1495152ca8638c927c1588b844f65bb05e3f29a0.tar.gz
gradecoin-1495152ca8638c927c1588b844f65bb05e3f29a0.tar.bz2
gradecoin-1495152ca8638c927c1588b844f65bb05e3f29a0.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.html36
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:&#x2F;&#x2F;gradecoin.xyz&#x2F;juice.css"> 27 <link rel="stylesheet" href="https:&#x2F;&#x2F;gradecoin.xyz&#x2F;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.
89Only people who are enrolled to the class can open Gradecoin accounts. 100Only people who are enrolled to the class can open Gradecoin accounts.
90This is enforced with your Student ID and a one time password you will receive.</p> 101This 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 &quot;</span><span style="color:#009854;">passwd</span><span style="color:#545052;">&quot;: &quot;</span><span style="color:#009854;">15 char secret</span><span style="color:#545052;">&quot;, 113 &quot;</span><span style="color:#009854;">passwd</span><span style="color:#545052;">&quot;: &quot;</span><span style="color:#009854;">15 char secret</span><span style="color:#545052;">&quot;,
103 &quot;</span><span style="color:#009854;">public_key</span><span style="color:#545052;">&quot;: &quot;</span><span style="color:#009854;">---BEGIN PUBLIC KEY...</span><span style="color:#545052;">&quot; 114 &quot;</span><span style="color:#009854;">public_key</span><span style="color:#545052;">&quot;: &quot;</span><span style="color:#009854;">---BEGIN PUBLIC KEY...</span><span style="color:#545052;">&quot;
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 &quot;hazardous&quot;. 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.
122You can now sign JWTs to send authorized transaction requests.</p> 146You 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>