Actions
Task #3192
closedDraft abstraction of GEP consumer
Start date:
09/08/2015
Due date:
% Done:
100%
Estimated time:
Description
Consumer in GEP is mainly the group member that will consume the data produced by the producer.
The core process of data consuming is as below:
- get the data packet and validate the packet
- get the encrypted C-KEY packet and validate the packet
- get the encrypted D-KEY packet and validate the packet
- decrypt the D-KEY with the private key of consumer
- decrypt the C-KEY with the D-KEY
- decrypt the data with C-KEY
Here is the abstraction of consumer:
/**
* @brief Consumer in group-based encryption protocol
*/
class Consumer
{
public:
class Error : public std::runtime_error
{
public:
explicit
Error(const std::string& what)
: std::runtime_error(what)
{
}
};
public:
Consumer(Face& face, const algo::RsaPrivateKey& decryptKey);
/**
* @brief Get the data buffer published by producer
*/
Buffer
consume(const Name& dataName);
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
/**
* @brief authenticate the Data packet
*/
bool
authenticateData(const Data& Data);
/**
* @brief authenticate the C-KEY data
*/
bool
authenticateCKey(const Data& cKeyData);
/**
* @brief authenticate the D-KEY data
*/
bool
authenticateDKey(const Data& dKeyData);
/**
* @brief Get the data packet by sending interest
*/
Data
sendInterest(const Name& dataName);
/**
* @brief decrypt buffer by rsa decrypt key
*/
Buffer
decryptGroupDKey(const Data& DKeyData, algo::RsaPrivateKey decryptKey) const;
/**
* @brief Decrypt buffer by aes decrypt key
*/
Buffer
decryptGroupCKey(const Data& CKeyData, algo::RsaPrivateKey decryptKey) const;
/**
* @brief Decrypt buffer by aes decrypt key
*/
Buffer
decryptGroupData(const Data& Data, algo::AesDecryptKey decryptKey) const;
/**
* @brief Fetch the data packet replying @p interest
*/
void
getResultFromInterest(const Interest& interest);
/**
* @brief Callback method when there is a packet @p data replying @p interest
*/
void
onData(const Interest& interest, const Data& data);
/**
* @brief Callback method when there is no packet @p data replying @p interest within timeout
*/
void
onTimeout(const Interest& interest);
private:
enum ResultSign {
RESULT_DATA = 0,
RESULT_TIMEOUT = 1,
RESULT_DEFAULT = 255
};
private:
ResultSign m_sign;
Data m_result;
ValidatorConfig m_validator;
Face& m_face;
algo::RsaPrivateKey m_decryptKey;
};
Updated by Yingdi Yu about 8 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
Actions