Analyzing messages in DKG

February 23, 2013 | Posted in Asynchronous Key Generation for IBE | Ajoy Oommen

In networkmessage.h, these are the message declarations for writing a message and reading the message.

PingNetworkMessage :

class PingNetworkMessage : public NetworkMessage
{
public:
  PingNetworkMessage(const BuddySet &buddyset, unsigned int t);
  PingNetworkMessage(const Buddy *buddy, const string &str, int g_recv_ID);
  string toString() const;
  unsigned int t;
  string DSA;
  string strMsg;
  bool msgValid;
};

In networkmessage.cc, these are the declarations.

PingNetworkMessage::PingNetworkMessage(const BuddySet &buddyset, unsigned int t): t(t) {
    string msgbody;
    //size_t signstart = msgbody.size();
    write_ui(msgbody, t);
    //size_t signend = msgbody.size();
    write_sig(buddyset, msgbody, toString());
    addMsgHeader(NET_MSG_PING, msgbody);
    addMsgID(msg_ID, msgbody);
    set_netMsgStr(msgbody);
}

PingNetworkMessage::PingNetworkMessage(const Buddy *buddy, const string &str, int g_recv_ID):
        NetworkMessage(str) {
    const unsigned char *bodyptr = (const unsigned char *)str.data() + headerLength;
    size_t bodylen = str.size() - headerLength;
    //const unsigned char *signstart = bodyptr;
    read_ui(bodyptr, bodylen, t);
    //const unsigned char *signend = bodyptr;
    strMsg = toString();
    msgValid = read_sig(buddy, bodyptr, bodylen, (const unsigned char *)strMsg.data(),
                                (const unsigned char *)strMsg.data()+ strMsg.length());
    DSA = str.substr(str.size()-bodylen- buddy->sig_size(), buddy->sig_size());
    msg_ID = g_recv_ID;
}

string PingNetworkMessage::toString() const{
    string msgStr;
    write_ui(msgStr, t);
    addMsgHeader(NET_MSG_PING, msgStr);
    return msgStr;
}
C++ DKG

Related Posts

05 Mar 2013 » Importing and exporting an element in PBC

02 Mar 2013 » Using python to complete IBC

27 Feb 2013 » Modifying a DKG header

23 Feb 2013 » Understanding DKG

20 Feb 2013 » Pseudo code for the mathematical functions

20 Feb 2013 » Distributed Key Generation in BFIBC

19 Feb 2013 » Modifying the DKG protocol

19 Feb 2013 » The DKG protocol, in short

19 Feb 2013 » The DKG Protocol

19 Feb 2013 » Asynchronous Distributed Key Generation for Identity-Based Cryptography