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
17c1988b
Commit
17c1988b
authored
Mar 23, 2017
by
Stephane Glondu
Browse files
s/channel_msg/signed_msg/g
parent
97ce1d4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/serializable.atd
View file @
17c1988b
...
...
@@ -129,18 +129,18 @@ type 'a result = {
result : plaintext;
}
(** {2 Channel messages support} *)
(** {2 PKI support} *)
type signed_msg = {
message : string;
signature : proof;
} <ocaml field_prefix="s_">
type 'a raw_channel_msg = {
recipient : 'a;
message : string;
} <ocaml field_prefix="raw_">
type channel_msg = {
message : string; (* raw_channel_msg *)
signature : proof;
} <ocaml field_prefix="channel_">
(** {2 Threshold decryption support} *)
type 'a cert_keys = {
...
...
src/lib/trustees.ml
View file @
17c1988b
...
...
@@ -158,18 +158,18 @@ module MakeChannels (G : GROUP) (M : RANDOM)
let
send
sk
raw_recipient
raw_message
=
let
msg
=
{
raw_recipient
;
raw_message
}
in
let
channel
_message
=
string_of_raw_channel_msg
G
.
write
msg
in
M
.
bind
(
P
.
sign
sk
channel
_message
)
(
fun
channel
_signature
->
let
msg
=
{
channel
_message
;
channel
_signature
}
in
P
.
encrypt
raw_recipient
(
string_of_
chan
ne
l
_msg
msg
)
let
s
_message
=
string_of_raw_channel_msg
G
.
write
msg
in
M
.
bind
(
P
.
sign
sk
s
_message
)
(
fun
s
_signature
->
let
msg
=
{
s
_message
;
s
_signature
}
in
P
.
encrypt
raw_recipient
(
string_of_
sig
ne
d
_msg
msg
)
)
let
recv
dk
vk
msg
=
let
msg
=
P
.
decrypt
dk
msg
|>
chan
ne
l
_msg_of_string
in
let
{
channel
_message
;
channel
_signature
}
=
msg
in
if
not
(
P
.
verify
vk
channel
_message
channel
_signature
)
then
let
msg
=
P
.
decrypt
dk
msg
|>
sig
ne
d
_msg_of_string
in
let
{
s
_message
;
s
_signature
}
=
msg
in
if
not
(
P
.
verify
vk
s
_message
s
_signature
)
then
failwith
"invalid signature on received message"
;
let
msg
=
raw_channel_msg_of_string
G
.
read
channel
_message
in
let
msg
=
raw_channel_msg_of_string
G
.
read
s
_message
in
let
{
raw_recipient
;
raw_message
}
=
msg
in
if
not
G
.(
raw_recipient
=~
g
**~
dk
)
then
failwith
"invalid recipient on received message"
;
...
...
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