blob: 7d4567bffb578fe59d9455101254e08fe7dd2df7 [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_RSA_HPP
21#define NDN_GEP_ALGO_RSA_HPP
22
23#include <ndn-cxx/security/key-params.hpp>
24
25#include "random-number-generator.hpp"
26#include "algo/encrypt-params.hpp"
27#include "decrypt-key.hpp"
28#include "error.hpp"
29
30namespace ndn {
31namespace gep {
32namespace algo {
33
34class Rsa
35{
36public:
37 static DecryptKey<Rsa>
38 generateKey(RandomNumberGenerator& rng, RsaKeyParams& params);
39
40 static EncryptKey<Rsa>
41 deriveEncryptKey(const Buffer& keyBits);
42
43 static Buffer
44 decrypt(const Buffer& keyBits, const Buffer& encryptedData, const EncryptParams& params);
45
46 static Buffer
47 encrypt(const Buffer& keyBits, const Buffer& plainData, const EncryptParams& params);
48};
49
50typedef DecryptKey<Rsa> RsaPrivateKey;
51typedef EncryptKey<Rsa> RsaPublicKey;
52
53} // namespace algo
54} // namespace gep
55} // namespace ndn
56
57#endif // NDN_GEP_ALGO_RSA_HPP