Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
belenios
belenios
Commits
4892092a
Commit
4892092a
authored
Jun 29, 2017
by
Stephane Glondu
Browse files
Threshold: (client-side) partial decryption
parent
7a17b8c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/tool/tool_js_pd.ml
View file @
4892092a
...
@@ -74,12 +74,21 @@ let compute_partial_decryption _ =
...
@@ -74,12 +74,21 @@ let compute_partial_decryption _ =
document
##
getElementById
(
Js
.
string
"private_key"
)
>>=
fun
e
->
document
##
getElementById
(
Js
.
string
"private_key"
)
>>=
fun
e
->
Dom_html
.
CoerceTo
.
input
e
>>=
fun
e
->
Dom_html
.
CoerceTo
.
input
e
>>=
fun
e
->
let
pk_str
=
Js
.
to_string
e
##
value
in
let
pk_str
=
Js
.
to_string
e
##
value
in
basic_check_private_key
pk_str
;
let
private_key
=
let
private_key
=
try
number_of_string
pk_str
try
with
e
->
let
epk
=
get_textarea
"encrypted_private_key"
in
Printf
.
ksprintf
let
module
PKI
=
Trustees
.
MakePKI
(
P
.
G
)
(
DirectRandom
)
in
failwith
"Error in format of private key: %s"
(
Printexc
.
to_string
e
)
let
module
C
=
Trustees
.
MakeChannels
(
P
.
G
)
(
DirectRandom
)
(
PKI
)
in
let
sk
=
PKI
.
derive_sk
pk_str
and
dk
=
PKI
.
derive_dk
pk_str
in
let
vk
=
P
.
G
.(
g
**~
sk
)
in
let
epk
=
C
.
recv
dk
vk
epk
in
(
partial_decryption_key_of_string
epk
)
.
pdk_decryption_key
with
Not_found
->
basic_check_private_key
pk_str
;
try
number_of_string
pk_str
with
e
->
Printf
.
ksprintf
failwith
"Error in format of private key: %s"
(
Printexc
.
to_string
e
)
in
in
let
factor
=
E
.
compute_factor
encrypted_tally
private_key
in
let
factor
=
E
.
compute_factor
encrypted_tally
private_key
in
set_textarea
"pd"
(
string_of_partial_decryption
P
.
G
.
write
factor
);
set_textarea
"pd"
(
string_of_partial_decryption
P
.
G
.
write
factor
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment