1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #pragma once
- #include <openssl/bio.h>
- #include <openssl/rsa.h>
- struct OpensslBIOTraits {
- using HandleType = BIO*;
- static inline const HandleType InvalidValue = nullptr;
- [[nodiscard]]
- static bool IsValid(const HandleType& Handle) noexcept {
- return Handle != InvalidValue;
- }
- static void Releasor(const HandleType& Handle) noexcept {
- BIO_free(Handle);
- }
- };
- struct OpensslBIOChainTraits {
- using HandleType = BIO*;
- static inline const HandleType InvalidValue = nullptr;
- [[nodiscard]]
- static bool IsValid(const HandleType& Handle) noexcept {
- return Handle != InvalidValue;
- }
- static void Releasor(const HandleType& Handle) noexcept {
- BIO_free_all(Handle);
- }
- };
- struct OpensslBNTraits {
- using HandleType = BIGNUM*;
- static inline const HandleType InvalidValue = nullptr;
- [[nodiscard]]
- static bool IsValid(const HandleType& Handle) noexcept {
- return Handle != InvalidValue;
- }
- static void Releasor(const HandleType& Handle) noexcept {
- BN_free(Handle);
- }
- };
- struct OpensslRSATraits {
- using HandleType = RSA*;
- static inline const HandleType InvalidValue = nullptr;
- [[nodiscard]]
- static bool IsValid(const HandleType& Handle) noexcept {
- return Handle != InvalidValue;
- }
- static void Releasor(const HandleType& Handle) noexcept {
- RSA_free(Handle);
- }
- };
|