Prashanth Swaminathan | c61cf19 | 2015-06-30 21:21:33 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Zhiyi Zhang | 19a11d2 | 2018-04-12 22:58:20 -0700 | [diff] [blame^] | 3 | * Copyright (c) 2014-2018, Regents of the University of California |
Prashanth Swaminathan | c61cf19 | 2015-06-30 21:21:33 -0700 | [diff] [blame] | 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 | |
Yingdi Yu | b3c4776 | 2016-03-20 19:37:27 -0700 | [diff] [blame] | 23 | #include "encrypt-params.hpp" |
| 24 | #include "../decrypt-key.hpp" |
Zhiyi Zhang | 19a11d2 | 2018-04-12 22:58:20 -0700 | [diff] [blame^] | 25 | #include <ndn-cxx/security/key-params.hpp> |
Prashanth Swaminathan | c61cf19 | 2015-06-30 21:21:33 -0700 | [diff] [blame] | 26 | |
| 27 | namespace ndn { |
| 28 | namespace gep { |
| 29 | namespace algo { |
| 30 | |
| 31 | class Rsa |
| 32 | { |
| 33 | public: |
| 34 | static DecryptKey<Rsa> |
Zhiyi Zhang | 19a11d2 | 2018-04-12 22:58:20 -0700 | [diff] [blame^] | 35 | generateKey(RsaKeyParams& params); |
Prashanth Swaminathan | c61cf19 | 2015-06-30 21:21:33 -0700 | [diff] [blame] | 36 | |
| 37 | static EncryptKey<Rsa> |
| 38 | deriveEncryptKey(const Buffer& keyBits); |
| 39 | |
| 40 | static Buffer |
Prashanth Swaminathan | d5b3eae | 2015-07-09 15:37:05 -0700 | [diff] [blame] | 41 | decrypt(const uint8_t* key, size_t keyLen, |
Zhiyi Zhang | 19a11d2 | 2018-04-12 22:58:20 -0700 | [diff] [blame^] | 42 | const uint8_t* payload, size_t payloadLen); |
Prashanth Swaminathan | c61cf19 | 2015-06-30 21:21:33 -0700 | [diff] [blame] | 43 | |
| 44 | static Buffer |
Prashanth Swaminathan | d5b3eae | 2015-07-09 15:37:05 -0700 | [diff] [blame] | 45 | encrypt(const uint8_t* key, size_t keyLen, |
Zhiyi Zhang | 19a11d2 | 2018-04-12 22:58:20 -0700 | [diff] [blame^] | 46 | const uint8_t* payload, size_t payloadLen); |
Prashanth Swaminathan | c61cf19 | 2015-06-30 21:21:33 -0700 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | typedef DecryptKey<Rsa> RsaPrivateKey; |
| 50 | typedef EncryptKey<Rsa> RsaPublicKey; |
| 51 | |
| 52 | } // namespace algo |
| 53 | } // namespace gep |
| 54 | } // namespace ndn |
| 55 | |
| 56 | #endif // NDN_GEP_ALGO_RSA_HPP |