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 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_RSA_HPP |
| 21 | #define NDN_GEP_ALGO_RSA_HPP |
| 22 | |
| 23 | #include <ndn-cxx/security/key-params.hpp> |
Yingdi Yu | b3c4776 | 2016-03-20 19:37:27 -0700 | [diff] [blame] | 24 | #include "../random-number-generator.hpp" |
| 25 | #include "encrypt-params.hpp" |
| 26 | #include "../decrypt-key.hpp" |
Prashanth Swaminathan | c61cf19 | 2015-06-30 21:21:33 -0700 | [diff] [blame] | 27 | |
| 28 | namespace ndn { |
| 29 | namespace gep { |
| 30 | namespace algo { |
| 31 | |
| 32 | class Rsa |
| 33 | { |
| 34 | public: |
| 35 | static DecryptKey<Rsa> |
| 36 | generateKey(RandomNumberGenerator& rng, RsaKeyParams& params); |
| 37 | |
| 38 | static EncryptKey<Rsa> |
| 39 | deriveEncryptKey(const Buffer& keyBits); |
| 40 | |
| 41 | static Buffer |
Prashanth Swaminathan | d5b3eae | 2015-07-09 15:37:05 -0700 | [diff] [blame] | 42 | decrypt(const uint8_t* key, size_t keyLen, |
| 43 | const uint8_t* payload, size_t payloadLen, |
| 44 | const EncryptParams& params); |
Prashanth Swaminathan | c61cf19 | 2015-06-30 21:21:33 -0700 | [diff] [blame] | 45 | |
| 46 | static Buffer |
Prashanth Swaminathan | d5b3eae | 2015-07-09 15:37:05 -0700 | [diff] [blame] | 47 | encrypt(const uint8_t* key, size_t keyLen, |
| 48 | const uint8_t* payload, size_t payloadLen, |
| 49 | const EncryptParams& params); |
Prashanth Swaminathan | c61cf19 | 2015-06-30 21:21:33 -0700 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | typedef DecryptKey<Rsa> RsaPrivateKey; |
| 53 | typedef EncryptKey<Rsa> RsaPublicKey; |
| 54 | |
| 55 | } // namespace algo |
| 56 | } // namespace gep |
| 57 | } // namespace ndn |
| 58 | |
| 59 | #endif // NDN_GEP_ALGO_RSA_HPP |