diff options
author | Florian Dold <florian.dold@gmail.com> | 2014-02-17 16:55:22 +0000 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2014-02-17 16:55:22 +0000 |
commit | 5287f057386174262284b427358d916176f2df4c (patch) | |
tree | ce4ddeb812bbc605d85f67196c0e0255a2cb0fc4 /src/main/java/org/gnunet/secretsharing/messages | |
parent | f4988bbbf0b185d26f3fb668c9dd0baa88c2a6e1 (diff) | |
download | gnunet-java-5287f057386174262284b427358d916176f2df4c.tar.gz gnunet-java-5287f057386174262284b427358d916176f2df4c.zip |
- java api for secretsharing
Diffstat (limited to 'src/main/java/org/gnunet/secretsharing/messages')
4 files changed, 197 insertions, 0 deletions
diff --git a/src/main/java/org/gnunet/secretsharing/messages/ClientDecryptMessage.java b/src/main/java/org/gnunet/secretsharing/messages/ClientDecryptMessage.java new file mode 100644 index 0000000..1dc0981 --- /dev/null +++ b/src/main/java/org/gnunet/secretsharing/messages/ClientDecryptMessage.java | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2014 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | package org.gnunet.secretsharing.messages; | ||
22 | |||
23 | import org.gnunet.construct.NestedMessage; | ||
24 | import org.gnunet.construct.UnionCase; | ||
25 | import org.gnunet.secretsharing.Ciphertext; | ||
26 | import org.gnunet.secretsharing.Share; | ||
27 | import org.gnunet.util.AbsoluteTimeMessage; | ||
28 | import org.gnunet.util.GnunetMessage; | ||
29 | |||
30 | /** | ||
31 | * Sent by the client to the service to request the cooperative decryption of a | ||
32 | * ciphertext. | ||
33 | */ | ||
34 | @UnionCase(781) | ||
35 | public class ClientDecryptMessage implements GnunetMessage.Body { | ||
36 | /** | ||
37 | * When should communication with other peers start? | ||
38 | */ | ||
39 | @NestedMessage | ||
40 | public AbsoluteTimeMessage start; | ||
41 | |||
42 | /** | ||
43 | * When should the operation have finished? | ||
44 | */ | ||
45 | @NestedMessage | ||
46 | public AbsoluteTimeMessage deadline; | ||
47 | |||
48 | /** | ||
49 | * Ciphertext to cooperatively decrypt. | ||
50 | */ | ||
51 | @NestedMessage | ||
52 | public Ciphertext ciphertext; | ||
53 | |||
54 | /** | ||
55 | * Our share of the secret key. | ||
56 | */ | ||
57 | @NestedMessage | ||
58 | public Share share; | ||
59 | } | ||
diff --git a/src/main/java/org/gnunet/secretsharing/messages/DecryptDoneMessage.java b/src/main/java/org/gnunet/secretsharing/messages/DecryptDoneMessage.java new file mode 100644 index 0000000..71f24da --- /dev/null +++ b/src/main/java/org/gnunet/secretsharing/messages/DecryptDoneMessage.java | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | |||
3 | This file is part of GNUnet. | ||
4 | (C) 2014 Christian Grothoff (and other contributing authors) | ||
5 | |||
6 | GNUnet is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 3, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with GNUnet; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
19 | Boston, MA 02111-1307, USA. | ||
20 | |||
21 | */ | ||
22 | |||
23 | package org.gnunet.secretsharing.messages; | ||
24 | |||
25 | import org.gnunet.construct.NestedMessage; | ||
26 | import org.gnunet.construct.UInt32; | ||
27 | import org.gnunet.construct.UnionCase; | ||
28 | import org.gnunet.secretsharing.Plaintext; | ||
29 | import org.gnunet.util.GnunetMessage; | ||
30 | |||
31 | /** | ||
32 | * Created by dold on 2/2/14. | ||
33 | */ | ||
34 | @UnionCase(782) | ||
35 | public class DecryptDoneMessage implements GnunetMessage.Body{ | ||
36 | |||
37 | /** | ||
38 | * Was the decryption successful? | ||
39 | */ | ||
40 | @UInt32 | ||
41 | public int success; | ||
42 | |||
43 | /** | ||
44 | * Plaintext, only valid if 'success' is non-zero. | ||
45 | */ | ||
46 | @NestedMessage | ||
47 | public Plaintext plaintext; | ||
48 | } | ||
diff --git a/src/main/java/org/gnunet/secretsharing/messages/GenerateMessage.java b/src/main/java/org/gnunet/secretsharing/messages/GenerateMessage.java new file mode 100644 index 0000000..b1ce6b2 --- /dev/null +++ b/src/main/java/org/gnunet/secretsharing/messages/GenerateMessage.java | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | |||
3 | This file is part of GNUnet. | ||
4 | (C) 2014 Christian Grothoff (and other contributing authors) | ||
5 | |||
6 | GNUnet is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 3, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with GNUnet; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
19 | Boston, MA 02111-1307, USA. | ||
20 | |||
21 | */ | ||
22 | |||
23 | package org.gnunet.secretsharing.messages; | ||
24 | |||
25 | import org.gnunet.construct.NestedMessage; | ||
26 | import org.gnunet.construct.UInt16; | ||
27 | import org.gnunet.construct.UnionCase; | ||
28 | import org.gnunet.construct.VariableSizeArray; | ||
29 | import org.gnunet.util.*; | ||
30 | |||
31 | |||
32 | @UnionCase(780) | ||
33 | public class GenerateMessage implements GnunetMessage.Body { | ||
34 | @NestedMessage | ||
35 | public HashCode sessionId; | ||
36 | |||
37 | @NestedMessage | ||
38 | public AbsoluteTimeMessage start; | ||
39 | |||
40 | @NestedMessage | ||
41 | public AbsoluteTimeMessage deadline; | ||
42 | |||
43 | @UInt16 | ||
44 | public int threshold; | ||
45 | |||
46 | @UInt16 | ||
47 | public int numPeers; | ||
48 | |||
49 | @VariableSizeArray(lengthField = "numPeers") | ||
50 | public PeerIdentity[] peers; | ||
51 | } | ||
diff --git a/src/main/java/org/gnunet/secretsharing/messages/SecretReadyMessage.java b/src/main/java/org/gnunet/secretsharing/messages/SecretReadyMessage.java new file mode 100644 index 0000000..479fe2c --- /dev/null +++ b/src/main/java/org/gnunet/secretsharing/messages/SecretReadyMessage.java | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2014 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | package org.gnunet.secretsharing.messages; | ||
22 | |||
23 | import org.gnunet.construct.NestedMessage; | ||
24 | import org.gnunet.construct.UnionCase; | ||
25 | import org.gnunet.secretsharing.Share; | ||
26 | import org.gnunet.util.GnunetMessage; | ||
27 | |||
28 | /** | ||
29 | * Sent by the service to the client when the key generation | ||
30 | * has been successful. | ||
31 | */ | ||
32 | @UnionCase(783) | ||
33 | public class SecretReadyMessage implements GnunetMessage.Body { | ||
34 | /** | ||
35 | * Share for the local peer. | ||
36 | */ | ||
37 | @NestedMessage | ||
38 | public Share share; | ||
39 | } | ||