Project

General

Profile

Actions

Task #3014

closed

Create key encryption helper

Added by Yingdi Yu almost 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Start date:
07/05/2015
Due date:
% Done:

100%

Estimated time:

Description

We should create a high level abstraction Encryptor, which prepare raw data into a encrypted Data packet. Its interface should look like this:

class Encryptor
{
  /**
   * @brief Encrypt @p payload using @p keybits with @p params
   *
   * This method should create an EncryptedContent and set it as the content of @p data.
   * The @p keyName should be set as EncryptKeyLocator. This method will prepare all the other field
   * in the EncryptedContent, such as EncryptAlgorithm, InitialVector, and EncryptedPayload. 
   */
  void
  symEncrypt(Data& data, const Buffer& payload, const Name& encrypted keyName, const Buffer& keybits, const EncryptParams& params);

  /**
   * @brief Encrypt @p payload using @p publicKey with @p params
   *
   * This method will decide, according to the size of @p publicKey and @p payload, whether to use a nonce symmetric key.
   * 
   * If @p payload is within the scope of @p publicKey, no nonce key is used.  The method will create an EncryptedContent
   * and set them as the content of @p data.  The @p keyName should be set as EncryptKeyLocator. This method will prepare 
   * all the other field in the EncryptedContent, such as EncryptAlgorithm, InitialVector, and EncryptedPayload. 
   * 
   * If @p payload is larger than the maximum scope of @p public key, this method will generate a nonce key, use @p publicKey
   * to encrypt the nonce key and use the nonce key (which is symmetric) to encrypt the payload.  Thus this method will create 
   * two EncryptedContent TLVs (the first one for the nonce-key and the second one for payload), both of them will be put into 
   * the same data packet.
   */
  void
  asymEncrypt(Data& data, const Buffer& payload, const Name& encrypted keyName, const PublicKey& publicKey, const EncryptParams);
}

Related issues 2 (0 open2 closed)

Blocked by NAC - Task #3013: Add InitialVector as an optional field in EncryptedContentClosedPrashanth Swaminathan07/05/2015

Actions
Blocks NAC - Task #3015: Primary Group ManagerClosedZhiyi Zhang07/05/2015

Actions
Actions #1

Updated by Yingdi Yu almost 10 years ago

  • Blocked by Task #3013: Add InitialVector as an optional field in EncryptedContent added
Actions #2

Updated by Yingdi Yu almost 10 years ago

Actions #3

Updated by Yingdi Yu almost 10 years ago

  • Assignee set to Prashanth Swaminathan
Actions #4

Updated by Yingdi Yu almost 10 years ago

  • Status changed from New to Code review
  • % Done changed from 0 to 80
Actions #5

Updated by Yingdi Yu over 9 years ago

  • Status changed from Code review to Closed
  • % Done changed from 80 to 100
Actions

Also available in: Atom PDF