aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/openssl/crypto/rsa.h
blob: 5cb16e195e170d80101762ccd00d3db6c70706da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include <util/generic/utility.h>
#include <util/generic/noncopyable.h>

struct rsa_st;

namespace NOpenSsl {
    class TBigInteger;

    namespace NRsa {
        class TPublicKey: public TNonCopyable {
        public:
            inline TPublicKey(TPublicKey&& other) noexcept {
                Swap(other);
            }

            TPublicKey(const TBigInteger& e, const TBigInteger& n);
            ~TPublicKey() noexcept;

            size_t OutputLength() const noexcept;

            TBigInteger EncryptNoPad(const TBigInteger& src) const;
            size_t EncryptNoPad(void* dst, const void* src, size_t size) const;

            inline void Swap(TPublicKey& other) noexcept {
                DoSwap(Key_, other.Key_);
            }

        private:
            rsa_st* Key_ = nullptr;
        };
    }
}