44 lines
No EOL
774 B
C++
44 lines
No EOL
774 B
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <memory>
|
|
#include <openssl/evp.h>
|
|
#include <openssl/rsa.h>
|
|
#include <openssl/types.h>
|
|
|
|
#include "RsaPrivateKey.hpp"
|
|
#include "RsaPublicKey.hpp"
|
|
|
|
|
|
namespace drp::util::crypto {
|
|
|
|
|
|
/**
|
|
* Represent a pair of RSA key.
|
|
*/
|
|
class RsaKeyPair {
|
|
public:
|
|
/**
|
|
* Generate a pair of public and private RSA keys.
|
|
*/
|
|
explicit RsaKeyPair(std::size_t size, int padMode = RSA_PKCS1_OAEP_PADDING);
|
|
|
|
/**
|
|
* Get the public key.
|
|
* @return the public key.
|
|
*/
|
|
[[nodiscard]] RsaPublicKey getPublicKey() const;
|
|
|
|
/**
|
|
* Get the private key.
|
|
* @return the private key.
|
|
*/
|
|
[[nodiscard]] RsaPrivateKey getPrivateKey() const;
|
|
|
|
private:
|
|
RsaPrivateKey privateKey;
|
|
RsaPublicKey publicKey;
|
|
};
|
|
|
|
|
|
} |