rsa.h 831 B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <util/generic/utility.h>
  3. #include <util/generic/noncopyable.h>
  4. struct rsa_st;
  5. namespace NOpenSsl {
  6. class TBigInteger;
  7. namespace NRsa {
  8. class TPublicKey: public TNonCopyable {
  9. public:
  10. inline TPublicKey(TPublicKey&& other) noexcept {
  11. Swap(other);
  12. }
  13. TPublicKey(const TBigInteger& e, const TBigInteger& n);
  14. ~TPublicKey() noexcept;
  15. size_t OutputLength() const noexcept;
  16. TBigInteger EncryptNoPad(const TBigInteger& src) const;
  17. size_t EncryptNoPad(void* dst, const void* src, size_t size) const;
  18. inline void Swap(TPublicKey& other) noexcept {
  19. DoSwap(Key_, other.Key_);
  20. }
  21. private:
  22. rsa_st* Key_ = nullptr;
  23. };
  24. }
  25. }