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 |
| |
typedef func_lib::function
< void(const Blob
&decryptedBlob)> | OnPlainText |
| |
|
| | Consumer (Face *face, KeyChain *keyChain, const Name &groupName, const Name &consumerName, const ptr_lib::shared_ptr< ConsumerDb > &database, const Link &cKeyLink=getNO_LINK(), const Link &dKeyLink=getNO_LINK()) |
| | 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, const Link &link=getNO_LINK()) |
| | 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...
|
| |
| void | decryptContent (const Data &data, const OnPlainText &onPlainText, const EncryptError::OnError &onError) |
| | A utility method to decrypt the data packet, retrieving the C-KEY Data from the network if necessary. 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, |
|
|
const Link & |
cKeyLink = getNO_LINK(), |
|
|
const Link & |
dKeyLink = getNO_LINK() |
|
) |
| |
|
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. |
| cKeyLink | (optional) The Link object to use in Interests for C-KEY retrieval. This makes a copy of the Link object. If the Link object's getDelegations().size() is zero, don't use it. If omitted, don't use a Link object. |
| dKeyLink | (optional) The Link object to use in Interests for D-KEY retrieval. This makes a copy of the Link object. If the Link object's getDelegations().size() is zero, don't use it. If omitted, don't use a Link object. |
| 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, |
|
|
const Link & |
link = getNO_LINK() |
|
) |
| |
|
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. |
| link | (optional) The Link object to use in Interests for data retrieval. This makes a copy of the Link object. If the Link object's getDelegations().size() is zero, don't use it. If omitted, don't use a Link object. |
| void ndn::Consumer::decryptContent |
( |
const Data & |
data, |
|
|
const OnPlainText & |
onPlainText, |
|
|
const EncryptError::OnError & |
onError |
|
) |
| |
|
inline |
A utility method to decrypt the data packet, retrieving the C-KEY Data from the network if necessary.
An application normally does not call this but calls the higher-level consume method.
- Parameters
-
| data | The data packet. This does not verify the packet. |
| onPlainText | When the data packet is decrypted, this calls onPlainText(decryptedBlob) with the decrypted blob. |
| onError | This calls onError(errorCode, message) for an error. |
| 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 files:
- include/ndn-cpp/encrypt/consumer.hpp
- src/encrypt/consumer.cpp