xaizek / rocketgit (License: AGPLv3+) (since 2018-12-09)
Light and fast Git hosting solution suitable to serve both as a hub or as a personal code storage with its tickets, pull requests, API and much more.
Commit f774edcd0c17f66dd4de54aa35a543bbafaff609

SSH key fingerprint: add SHA256 support
Till now, only md5 was supported, but OpenSSH switched to SHA256 by default.
Author: Catalin(ux) M. BOIE
Author date (UTC): 2015-06-04 20:31
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2015-06-04 20:31
Parent(s): 33a9cef11227407d2cdf63056e71b66dd6106f62
Signing key:
Tree: dcfe0d641af474d3a2ad41607e30fdb8f4c732e4
File Lines added Lines deleted
inc/keys.inc.php 4 1
root/themes/default/user/keys/list/line.html 1 1
tests/keys.php 11 3
File inc/keys.inc.php changed (mode: 100644) (index 0b05323..dc167c4)
... ... function rg_keys_info($key)
243 243 $a = array(); $a = array();
244 244 for ($i = 0; $i < 16; $i++) for ($i = 0; $i < 16; $i++)
245 245 $a[] = substr($digest, $i * 2, 2); $a[] = substr($digest, $i * 2, 2);
246 $ret['fingerprint'] = implode(":", $a);
246 $ret['fingerprint_md5'] = implode(":", $a);
247
248 $_x = base64_encode(hash('sha256', $d, TRUE));
249 $ret['fingerprint_sha256'] = rtrim($_x, "=");
247 250
248 251 $ret['ok'] = 1; $ret['ok'] = 1;
249 252 break; break;
File root/themes/default/user/keys/list/line.html changed (mode: 100644) (index 5009f69..b740ba2)
1 1 <tr> <tr>
2 2 <td><input type="checkbox" name="key_delete_ids[@@key_id@@]" /></td> <td><input type="checkbox" name="key_delete_ids[@@key_id@@]" /></td>
3 3 <td>@@itime@@</td> <td>@@itime@@</td>
4 <td>@@fingerprint@@</td>
4 <td><small>MD5:@@fingerprint_md5@@<br />SHA256:@@fingerprint_sha256@@</small></td>
5 5 <td>@@comment@@</td> <td>@@comment@@</td>
6 6 <td>@@first_use@@</td> <td>@@first_use@@</td>
7 7 <td>@@last_use@@</td> <td>@@last_use@@</td>
File tests/keys.php changed (mode: 100644) (index 4576db7..e092a10)
... ... if ($r['ok'] != 1) {
146 146 rg_log("Error for a valid key (ecdsa): " . rg_keys_error() . "!"); rg_log("Error for a valid key (ecdsa): " . rg_keys_error() . "!");
147 147 exit(1); exit(1);
148 148 } }
149 if (strcasecmp($r['fingerprint'], '85:8f:2f:84:c2:db:88:e5:95:f6:22:b9:8d:91:59:cc') != 0) {
150 rg_log("Invalid fingerprint!");
149 if (strcasecmp($r['fingerprint_md5'], '85:8f:2f:84:c2:db:88:e5:95:f6:22:b9:8d:91:59:cc') != 0) {
150 rg_log_ml("r=" . print_r($r, TRUE));
151 rg_log("Invalid md5 fingerprint!");
152 exit(1);
153 }
154 if (strcasecmp($r['fingerprint_sha256'], 'd0FRDYxeXCcS/ZBd4wGbzCRHnh5VPB2zjoYYJRg5Gwo') != 0) {
155 rg_log_ml("r=" . print_r($r, TRUE));
156 rg_log("Invalid sha256 fingerprint!");
151 157 exit(1); exit(1);
152 158 } }
153 159
 
... ... $comment = 'comment';
159 165 $key = $type . ' ' . $body . ' ' . $comment; $key = $type . ' ' . $body . ' ' . $comment;
160 166 $r = rg_keys_info($key); $r = rg_keys_info($key);
161 167 if ($r['ok'] != 1) { if ($r['ok'] != 1) {
168 rg_log_ml("r=" . print_r($r, TRUE));
162 169 rg_log("Error for a valid key (ed25519): " . rg_keys_error() . "!"); rg_log("Error for a valid key (ed25519): " . rg_keys_error() . "!");
163 170 exit(1); exit(1);
164 171 } }
165 if (strcasecmp($r['fingerprint'], '28:f7:1b:cb:ba:43:0a:41:b8:30:a3:8e:8f:bc:d5:4a') != 0) {
172 if (strcasecmp($r['fingerprint_md5'], '28:f7:1b:cb:ba:43:0a:41:b8:30:a3:8e:8f:bc:d5:4a') != 0) {
173 rg_log_ml("r=" . print_r($r, TRUE));
166 174 rg_log("Invalid fingerprint!"); rg_log("Invalid fingerprint!");
167 175 exit(1); exit(1);
168 176 } }
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master