Monero
Toggle main menu visibility
Loading...
Searching...
No Matches
src
multisig
multisig_kex_msg.h
Go to the documentation of this file.
1
// Copyright (c) 2021-2022, The Monero Project
2
//
3
// All rights reserved.
4
//
5
// Redistribution and use in source and binary forms, with or without modification, are
6
// permitted provided that the following conditions are met:
7
//
8
// 1. Redistributions of source code must retain the above copyright notice, this list of
9
// conditions and the following disclaimer.
10
//
11
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
12
// of conditions and the following disclaimer in the documentation and/or other
13
// materials provided with the distribution.
14
//
15
// 3. Neither the name of the copyright holder nor the names of its contributors may be
16
// used to endorse or promote products derived from this software without specific
17
// prior written permission.
18
//
19
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29
#pragma once
30
31
#include "
crypto/crypto.h
"
32
33
#include <cstdint>
34
#include <vector>
35
36
37
namespace
multisig
38
{
40
// multisig key exchange message
41
// - can parse and validate an input message
42
// - can construct and sign a new message
43
//
44
// msg_content = kex_round | signing_pubkey | expand(msg_pubkeys) | OPTIONAL msg_privkey
45
// msg_to_sign = versioning-domain-sep | msg_content
46
// msg = versioning-domain-sep | b58(msg_content | crypto_sig[signing_privkey](msg_to_sign))
47
//
48
// note: round 1 messages will contain a private key (e.g. for the aggregate multisig private view key)
50
class
multisig_kex_msg
final
51
{
52
//member types: none
53
54
//constructors
55
public
:
56
// default constructor
57
multisig_kex_msg
() =
default
;
58
59
// construct from info
60
multisig_kex_msg
(
const
std::uint32_t
round
,
61
const
crypto::secret_key
&signing_privkey,
62
std::vector<crypto::public_key> msg_pubkeys,
63
const
crypto::secret_key
&msg_privkey =
crypto::null_skey
);
64
65
// construct from string
66
multisig_kex_msg
(std::string msg);
67
68
// copy constructor: default
69
70
//destructor: default
71
~multisig_kex_msg
() =
default
;
72
73
//overloaded operators: none
74
75
//member functions
76
// get msg string
77
const
std::string&
get_msg
()
const
{
return
m_msg
; }
78
// get kex round
79
std::uint32_t
get_round
()
const
{
return
m_kex_round
; }
80
// get msg pubkeys
81
const
std::vector<crypto::public_key>&
get_msg_pubkeys
()
const
{
return
m_msg_pubkeys
; }
82
// get msg privkey
83
const
crypto::secret_key
&
get_msg_privkey
()
const
{
return
m_msg_privkey
; }
84
// get msg signing pubkey
85
const
crypto::public_key
&
get_signing_pubkey
()
const
{
return
m_signing_pubkey
; }
86
87
private
:
88
// msg_to_sign = versioning-domain-sep | kex_round | signing_pubkey | expand(msg_pubkeys) | OPTIONAL msg_privkey
89
crypto::hash
get_msg_to_sign
()
const
;
90
// set: msg string based on msg contents, signing pubkey based on input privkey
91
void
construct_msg
(
const
crypto::secret_key
&signing_privkey);
92
// parse msg string into parts, validate contents and signature
93
void
parse_and_validate_msg
();
94
95
//member variables
96
private
:
97
// message as string
98
std::string
m_msg
;
99
100
// key exchange round this msg was produced for
101
std::uint32_t
m_kex_round
;
102
// pubkeys stored in msg
103
std::vector<crypto::public_key>
m_msg_pubkeys
;
104
// privkey stored in msg (if kex round 1)
105
crypto::secret_key
m_msg_privkey
;
106
// pubkey used to sign this msg
107
crypto::public_key
m_signing_pubkey
;
108
};
109
}
//namespace multisig
round
#define round(rm, y, x, k)
Definition
aesb.c:52
multisig::multisig_kex_msg::parse_and_validate_msg
void parse_and_validate_msg()
Definition
multisig_kex_msg.cpp:207
multisig::multisig_kex_msg::get_msg_pubkeys
const std::vector< crypto::public_key > & get_msg_pubkeys() const
Definition
multisig_kex_msg.h:81
multisig::multisig_kex_msg::m_kex_round
std::uint32_t m_kex_round
Definition
multisig_kex_msg.h:101
multisig::multisig_kex_msg::m_msg
std::string m_msg
Definition
multisig_kex_msg.h:98
multisig::multisig_kex_msg::multisig_kex_msg
multisig_kex_msg()=default
multisig::multisig_kex_msg::m_msg_pubkeys
std::vector< crypto::public_key > m_msg_pubkeys
Definition
multisig_kex_msg.h:103
multisig::multisig_kex_msg::m_signing_pubkey
crypto::public_key m_signing_pubkey
Definition
multisig_kex_msg.h:107
multisig::multisig_kex_msg::m_msg_privkey
crypto::secret_key m_msg_privkey
Definition
multisig_kex_msg.h:105
multisig::multisig_kex_msg::~multisig_kex_msg
~multisig_kex_msg()=default
multisig::multisig_kex_msg::get_signing_pubkey
const crypto::public_key & get_signing_pubkey() const
Definition
multisig_kex_msg.h:85
multisig::multisig_kex_msg::get_msg
const std::string & get_msg() const
Definition
multisig_kex_msg.h:77
multisig::multisig_kex_msg::get_round
std::uint32_t get_round() const
Definition
multisig_kex_msg.h:79
multisig::multisig_kex_msg::get_msg_privkey
const crypto::secret_key & get_msg_privkey() const
Definition
multisig_kex_msg.h:83
multisig::multisig_kex_msg::get_msg_to_sign
crypto::hash get_msg_to_sign() const
Definition
multisig_kex_msg.cpp:109
multisig::multisig_kex_msg::construct_msg
void construct_msg(const crypto::secret_key &signing_privkey)
Definition
multisig_kex_msg.cpp:157
crypto.h
crypto::null_skey
const crypto::secret_key null_skey
Definition
crypto.cpp:75
crypto::secret_key
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition
crypto.h:72
crypto::public_key
POD_CLASS public_key
Definition
crypto.h:64
crypto::hash
POD_CLASS hash
Definition
hash.h:49
multisig
Definition
multisig.cpp:46
Generated on
for Monero by
1.17.0