Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 268fe551 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Complete binding of Tool_credgen

parent 40c74209
......@@ -52,6 +52,32 @@
<div><textarea id="credgen_group" rows="1" cols="80"></textarea></div>
</div>
</div>
<div>
<h3>Generate anonymous credentials</h3>
Number of credentials to generate:
<div><textarea id="credgen_number"></textarea></div>
<button id="do_credgen_generate">Generate</button>
</div>
<div>
<h3>Generate credentials with identity matching</h3>
<div>
List of identities:
<div><textarea id="credgen_ids"></textarea></div>
</div>
<button id="do_credgen_ids">Generate</button>
</div>
<div>
<h3>Generated credentials</h3>
<textarea id="credgen_generated_creds" readonly="readonly"></textarea>
</div>
<div>
<h3>Generated public keys</h3>
<textarea id="credgen_generated_pks" readonly="readonly"></textarea>
</div>
<div>
<h3>Fingerprints of generated public keys</h3>
<textarea id="credgen_generated_hashed" readonly="readonly"></textarea>
</div>
<div>
<h3>Check a credential</h3>
<div>
......
......@@ -134,8 +134,48 @@ module Credgen = struct
let cred = get_textarea "credgen_derive_input" in
set_textarea "credgen_derive_output" (X.derive cred)
let generate ids =
let module P : PARAMS = struct
let uuid = get_textarea "credgen_uuid"
let group = get_textarea "credgen_group"
end in
let module X = (val make (module P : PARAMS) : S) in
let privs, pubs, hashs =
List.fold_left (fun (privs, pubs, hashs) id ->
let priv, pub, hash = X.generate () in
let priv = id ^ " " ^ priv and hash = id ^ " " ^ hash in
priv::privs, pub::pubs, hash::hashs
) ([], [], []) ids
in
set_textarea "credgen_generated_creds"
(privs |> List.rev |> String.concat "\n");
set_textarea "credgen_generated_pks"
(pubs |> List.sort compare |> String.concat "\n");
set_textarea "credgen_generated_hashed"
(hashs |> List.rev |> String.concat "\n")
let generate_n () =
get_textarea "credgen_number" |>
int_of_string |> generate_ids |> generate
let generate_ids () =
let ids = get_textarea "credgen_ids" ^ "\n" in
let n = String.length ids in
let rec loop accu i =
if i < n
then (
let j = String.index_from ids i '\n' in
let line = String.sub ids i (j-i) in
let accu = if line = "" then accu else line :: accu in
loop accu (j+1)
) else List.rev accu
in
loop [] 0 |> generate
let cmds = [
"do_credgen_derive", derive;
"do_credgen_generate", generate_n;
"do_credgen_ids", generate_ids;
]
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment