net.named_data.jndn.encrypt
public class Producer extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Producer.OnEncryptedKeys |
Modifier and Type | Field and Description |
---|---|
static EncryptError.OnError |
defaultOnError
The default OnError callback which does nothing.
|
Constructor and Description |
---|
Producer(Name prefix,
Name dataType,
Face face,
KeyChain keyChain,
ProducerDb database)
Create a Producer to use the given ProducerDb, Face and other values.
|
Producer(Name prefix,
Name dataType,
Face face,
KeyChain keyChain,
ProducerDb database,
int repeatAttempts)
Create a Producer to use the given ProducerDb, Face and other values.
|
Modifier and Type | Method and Description |
---|---|
Name |
createContentKey(double timeSlot,
Producer.OnEncryptedKeys onEncryptedKeys)
Call the main createContentKey method where onError is defaultOnError.
|
Name |
createContentKey(double timeSlot,
Producer.OnEncryptedKeys onEncryptedKeys,
EncryptError.OnError onError)
Create the content key corresponding to the timeSlot.
|
void |
produce(Data data,
double timeSlot,
Blob content)
Call the main produce method where onError is defaultOnError.
|
void |
produce(Data data,
double timeSlot,
Blob content,
EncryptError.OnError onError)
Encrypt the given content with the content key that covers timeSlot, and
update the data packet with the encrypted content and an appropriate data
name.
|
public static final EncryptError.OnError defaultOnError
public Producer(Name prefix, Name dataType, Face face, KeyChain keyChain, ProducerDb database, int repeatAttempts)
prefix
- The producer name prefix. This makes a copy of the Name.dataType
- The dataType portion of the producer name. This makes a
copy of the Name.face
- The face used to retrieve keys.keyChain
- The keyChain used to sign data packets.database
- The ProducerDb database for storing keys.repeatAttempts
- The maximum retry for retrieving keys.public Producer(Name prefix, Name dataType, Face face, KeyChain keyChain, ProducerDb database)
prefix
- The producer name prefix.dataType
- The dataType portion of the producer name.face
- The face used to retrieve keys.keyChain
- The keyChain used to sign data packets.database
- The ProducerDb database for storing keys.public final Name createContentKey(double timeSlot, Producer.OnEncryptedKeys onEncryptedKeys, EncryptError.OnError onError) throws ProducerDb.Error, IOException, SecurityException
timeSlot
- The time slot as milliseconds since Jan 1, 1970 UTC.onEncryptedKeys
- If this creates a content key, then this calls
onEncryptedKeys.onEncryptedKeys(keys) where keys is a list of encrypted
content key Data packets. If onEncryptedKeys is null, this does not use it.
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.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.ProducerDb.Error
IOException
SecurityException
public final Name createContentKey(double timeSlot, Producer.OnEncryptedKeys onEncryptedKeys) throws ProducerDb.Error, IOException, SecurityException
public final void produce(Data data, double timeSlot, Blob content, EncryptError.OnError onError) throws ProducerDb.Error, IOException, SecurityException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, InvalidKeySpecException
data
- An empty Data object which is updated.timeSlot
- The time slot as milliseconds since Jan 1, 1970 UTC.content
- The content to encrypt.onError
- This calls onError.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.ProducerDb.Error
IOException
SecurityException
NoSuchAlgorithmException
NoSuchPaddingException
InvalidKeyException
IllegalBlockSizeException
BadPaddingException
InvalidAlgorithmParameterException
InvalidKeySpecException
public final void produce(Data data, double timeSlot, Blob content) throws ProducerDb.Error, IOException, SecurityException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, InvalidKeySpecException
Copyright © 2016. All rights reserved.