Prashanth Swaminathan | c61cf19 | 2015-06-30 21:21:33 -0700 | [diff] [blame] | 1 | /* -*- 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 ndn-group-encrypt (Group-based Encryption Protocol for NDN). |
| 6 | * See AUTHORS.md for complete list of ndn-group-encrypt authors and contributors. |
| 7 | * |
| 8 | * ndn-group-encrypt is free software: you can redistribute it and/or modify it under |
| 9 | * the terms of the GNU General Public License as published by the Free Software |
| 10 | * Foundation, either version 3 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * ndn-group-encrypt is distributed in the hope that it will be useful, but WITHOUT |
| 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
| 14 | * A PARTICULAR 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 | * ndn-group-encrypt, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #ifndef NDN_GEP_ENCRYPT_KEY_HPP |
| 21 | #define NDN_GEP_ENCRYPT_KEY_HPP |
| 22 | |
| 23 | #include "common.hpp" |
| 24 | |
| 25 | namespace ndn { |
| 26 | namespace gep { |
| 27 | |
| 28 | template<class Algorithm> |
| 29 | class EncryptKey |
| 30 | { |
| 31 | public: |
| 32 | EncryptKey(Buffer&& keyBits) |
| 33 | : m_keyBits(keyBits) |
| 34 | { |
| 35 | } |
| 36 | |
| 37 | Buffer |
| 38 | encrypt(const Buffer& plainData) |
| 39 | { |
| 40 | return Algorithm::encrypt(m_keyBits, plainData); |
| 41 | } |
| 42 | |
| 43 | const Buffer& |
| 44 | getKeyBits() const |
| 45 | { |
| 46 | return m_keyBits; |
| 47 | } |
| 48 | |
| 49 | private: |
| 50 | Buffer m_keyBits; |
| 51 | }; |
| 52 | |
| 53 | } // namespace gep |
| 54 | } // namespace ndn |
| 55 | |
| 56 | #endif // NDN_GEP_ENCRYPT_KEY_HPP |