A Consumer manages fetched group keys used to decrypt a data packet in the group-based encryption protocol.
More...
#include <consumer.hpp>
|
|
typedef func_lib::function< void(const ptr_lib::shared_ptr< Data > &contentData, const Blob &result)> | OnConsumeComplete |
| |
|
| | Consumer (Face *face, KeyChain *keyChain, const Name &groupName, const Name &consumerName, const ptr_lib::shared_ptr< ConsumerDb > &database) |
| | Create a Consumer to use the given ConsumerDb, Face and other values. More...
|
| |
| void | consume (const Name &contentName, const OnConsumeComplete &onConsumeComplete, const EncryptError::OnError &onError) |
| | Express an Interest to fetch the content packet with contentName, and decrypt it, fetching keys as needed. More...
|
| |
| void | setGroup (const Name &groupName) |
| | Set the group name. More...
|
| |
| void | addDecryptionKey (const Name &keyName, const Blob &keyBlob) |
| | Add a new decryption key with keyName and keyBlob to the database. More...
|
| |
A Consumer manages fetched group keys used to decrypt a data packet in the group-based encryption protocol.
- Note
- This class is an experimental feature. The API may change.
| ndn::Consumer::Consumer |
( |
Face * |
face, |
|
|
KeyChain * |
keyChain, |
|
|
const Name & |
groupName, |
|
|
const Name & |
consumerName, |
|
|
const ptr_lib::shared_ptr< ConsumerDb > & |
database |
|
) |
| |
|
inline |
Create a Consumer to use the given ConsumerDb, Face and other values.
- Parameters
-
| face | The face used for data packet and key fetching. This is only a pointer to a Face object which must remain valid for the life of this Consumer. |
| keyChain | The keyChain used to verify data packets. This is only a pointer to a KeyChain object which must remain valid for the life of this Consumer. |
| groupName | The reading group name that the consumer belongs to. This makes a copy of the Name. |
| consumerName | The identity of the consumer. This makes a copy of the Name. |
| database | The ConsumerDb database for storing decryption keys. |
| void ndn::Consumer::addDecryptionKey |
( |
const Name & |
keyName, |
|
|
const Blob & |
keyBlob |
|
) |
| |
|
inline |
Add a new decryption key with keyName and keyBlob to the database.
- Parameters
-
| keyName | The key name. |
| keyBlob | The encoded key. |
- Exceptions
-
| ConsumerDb::Error | if a key with the same keyName already exists in the database, or other database error. |
| runtime_error | if the consumer name is not a prefix of the key name. |
| void ndn::Consumer::consume |
( |
const Name & |
contentName, |
|
|
const OnConsumeComplete & |
onConsumeComplete, |
|
|
const EncryptError::OnError & |
onError |
|
) |
| |
|
inline |
Express an Interest to fetch the content packet with contentName, and decrypt it, fetching keys as needed.
- Parameters
-
| contentName | The name of the content packet. |
| onConsumeComplete | When the content packet is fetched and decrypted, this calls onConsumeComplete(contentData, result) where contentData is the fetched Data packet and result is the decrypted plain text Blob. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions. |
| onError | This calls onError(errorCode, message) for an error. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions. |
| void ndn::Consumer::setGroup |
( |
const Name & |
groupName | ) |
|
|
inline |
Set the group name.
- Parameters
-
| groupName | The reading group name that the consumer belongs to. This makes a copy of the Name. |
The documentation for this class was generated from the following file: