38 lines
871 B
C++
38 lines
871 B
C++
#pragma once
|
|
|
|
#include "lib/utils/bts_no_copy.h"
|
|
|
|
#include "PrivateKey.h"
|
|
|
|
namespace bts
|
|
{
|
|
namespace crypto
|
|
{
|
|
|
|
class PublicKey : public PrivateKey
|
|
{
|
|
BTS_NO_COPY(PublicKey);
|
|
public:
|
|
PublicKey(const PrivateKey&);
|
|
virtual ~PublicKey();
|
|
|
|
virtual bool encrypt(const std::iostream& in_dat, std::iostream& out_data) const;
|
|
virtual bool decrypt(const std::iostream& in_dat, std::iostream& out_data) const;
|
|
|
|
static const PublicKeyPtr create(const PrivateKey& private_key);
|
|
static const PublicKeyPtr read_file(const std::string& filename);
|
|
static const PublicKeyPtr read_stream(std::istream& stream);
|
|
static const PublicKeyPtr read_string(const std::string& public_key);
|
|
|
|
|
|
protected:
|
|
virtual void write(openssl::BIO* bio, CipherType::type cipher_type) const;
|
|
protected:
|
|
PublicKey(openssl::EVP_PKEY*);
|
|
|
|
};
|
|
|
|
}
|
|
}
|
|
|