aes-algorithm.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 // (This is ported from ndn::gep::algo::Aes, and named AesAlgorithm because
24 // "Aes" is very short and not all the Common Client Libraries have namespaces.)
25 
26 #ifndef NDN_AES_ALGORITHM_HPP
27 #define NDN_AES_ALGORITHM_HPP
28 
29 #include "../../security/key-params.hpp"
30 #include "encrypt-params.hpp"
31 #include "../encrypt-key.hpp"
32 #include "../decrypt-key.hpp"
33 
34 namespace ndn {
35 
41 class AesAlgorithm {
42 public:
48  static DecryptKey
49  generateKey(const AesKeyParams& params);
50 
56  static EncryptKey
57  deriveEncryptKey(const Blob& keyBits)
58  {
59  return EncryptKey(keyBits);
60  }
61 
70  static Blob
71  decrypt
72  (const Blob& keyBits, const Blob& encryptedData, const EncryptParams& params);
73 
82  static Blob
83  encrypt
84  (const Blob& keyBits, const Blob& plainData, const EncryptParams& params);
85 
86  static size_t BLOCK_SIZE;
87 };
88 
89 }
90 
91 #endif
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
An EncryptKey supplies the key for encrypt.
Definition: encrypt-key.hpp:34
Definition: key-params.hpp:107
Definition: decrypt-key.hpp:34
An EncryptParams holds an algorithm type and other parameters used to encrypt and decrypt...
Definition: encrypt-params.hpp:36
The AesAlgorithm class provides static methods to manipulate keys, encrypt and decrypt using the AES ...
Definition: aes-algorithm.hpp:41
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
Definition: blob.hpp:42
static Blob encrypt(const Blob &keyBits, const Blob &plainData, const EncryptParams &params)
Encrypt the plainData using the keyBits according the encrypt params.
Definition: aes-algorithm.cpp:76
static Blob decrypt(const Blob &keyBits, const Blob &encryptedData, const EncryptParams &params)
Decrypt the encryptedData using the keyBits according the encrypt params.
Definition: aes-algorithm.cpp:48
static EncryptKey deriveEncryptKey(const Blob &keyBits)
Derive a new encrypt key from the given decrypt key value.
Definition: aes-algorithm.hpp:57
static DecryptKey generateKey(const AesKeyParams &params)
Generate a new random decrypt key for AES based on the given params.
Definition: aes-algorithm.cpp:33