blob: 657d6c0f82020f64b24905c4f91ea9378f6f994c [file] [log] [blame]
Prashanth Swaminathanc61cf192015-06-30 21:21:33 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014-2015, Regents of the University of California
4 *
5 * This file is part of gep (Group-based Encryption Protocol for NDN).
6 * See AUTHORS.md for complete list of gep authors and contributors.
7 *
8 * gep is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * gep is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * gep, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef NDN_GEP_ALGO_AES_HPP
21#define NDN_GEP_ALGO_AES_HPP
22
23#include <ndn-cxx/security/key-params.hpp>
24#include "random-number-generator.hpp"
25#include "algo/encrypt-params.hpp"
26#include "decrypt-key.hpp"
Prashanth Swaminathand5b3eae2015-07-09 15:37:05 -070027
Prashanth Swaminathanc61cf192015-06-30 21:21:33 -070028
29namespace ndn {
30namespace gep {
31namespace algo {
32
33class Aes
34{
35public:
36 static DecryptKey<Aes>
37 generateKey(RandomNumberGenerator& rng, AesKeyParams& params);
38
39 static EncryptKey<Aes>
40 deriveEncryptKey(const Buffer& keyBits);
41
42 static Buffer
Prashanth Swaminathand5b3eae2015-07-09 15:37:05 -070043 decrypt(const uint8_t* key, size_t keyLen,
44 const uint8_t* payload, size_t payloadLen,
45 const EncryptParams& params);
Prashanth Swaminathanc61cf192015-06-30 21:21:33 -070046
47 static Buffer
Prashanth Swaminathand5b3eae2015-07-09 15:37:05 -070048 encrypt(const uint8_t* key, size_t keyLen,
49 const uint8_t* payload, size_t payloadLen,
50 const EncryptParams& params);
Prashanth Swaminathanc61cf192015-06-30 21:21:33 -070051};
52
53typedef DecryptKey<Aes> AesEncryptKey;
54typedef EncryptKey<Aes> AesDecryptKey;
55
56} // namespace algo
57} // namespace gep
58} // namespace ndn
59
60#endif // NDN_GEP_ALGO_AES_ECB_HPP