rsa-algorithm.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 // (This is ported from ndn::gep::algo::Rsa, and named RsaAlgorithm because
24 // "Rsa" is very short and not all the Common Client Libraries have namespaces.)
25 
26 #ifndef NDN_RSA_ALGORITHM_HPP
27 #define NDN_RSA_ALGORITHM_HPP
28 
29 #include "../../security/key-params.hpp"
30 #include "encrypt-params.hpp"
31 #include "../encrypt-key.hpp"
32 #include "../decrypt-key.hpp"
33 
34 namespace ndn {
35 
41 class RsaAlgorithm {
42 public:
48  static DecryptKey
49  generateKey(const RsaKeyParams& params);
50 
57  static EncryptKey
58  deriveEncryptKey(const Blob& keyBits);
59 
67  static Blob
68  decrypt
69  (const Blob& keyBits, const Blob& encryptedData, const EncryptParams& params);
70 
78  static Blob
79  encrypt
80  (const Blob& keyBits, const Blob& plainData, const EncryptParams& params);
81 };
82 
83 }
84 
85 #endif
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
An EncryptKey supplies the key for encrypt.
Definition: encrypt-key.hpp:34
Definition: decrypt-key.hpp:34
static EncryptKey deriveEncryptKey(const Blob &keyBits)
Derive a new encrypt key from the given decrypt key value.
Definition: rsa-algorithm.cpp:61
Definition: key-params.hpp:59
An EncryptParams holds an algorithm type and other parameters used to encrypt and decrypt...
Definition: encrypt-params.hpp:36
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
Definition: blob.hpp:42
The RsaAlgorithm class provides static methods to manipulate keys, encrypt and decrypt using RSA...
Definition: rsa-algorithm.hpp:41
static DecryptKey generateKey(const RsaKeyParams &params)
Generate a new random decrypt key for RSA based on the given params.
Definition: rsa-algorithm.cpp:40
static Blob decrypt(const Blob &keyBits, const Blob &encryptedData, const EncryptParams &params)
Decrypt the encryptedData using the keyBits according the encrypt params.
static Blob encrypt(const Blob &keyBits, const Blob &plainData, const EncryptParams &params)
Encrypt the plainData using the keyBits according the encrypt params.