implement ecdsa
This commit is contained in:
@@ -41,8 +41,10 @@ struct Ref : std::unique_ptr<T, RefDeleter<T>>
|
||||
explicit Ref(T *x) noexcept : base{x} {}
|
||||
|
||||
Ref(Ref &&ref) noexcept = default;
|
||||
Ref(const Ref &ref) noexcept {
|
||||
*this = ref;
|
||||
Ref(const Ref &ref) noexcept : base{ref.get()} {
|
||||
if (*this) {
|
||||
RefTraits<T>::UpRef(this->get());
|
||||
}
|
||||
}
|
||||
|
||||
Ref &operator=(Ref&&) noexcept = default;
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "ref.hpp"
|
||||
|
||||
#include <boost/signals2.hpp>
|
||||
|
||||
#include <memory>
|
||||
@@ -74,3 +76,35 @@ public:
|
||||
return complete_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class SaslEcdsa final : public SaslMechanism
|
||||
{
|
||||
std::string message1_;
|
||||
Ref<EVP_PKEY> key_;
|
||||
int stage_;
|
||||
|
||||
public:
|
||||
SaslEcdsa(std::string authcid, std::string authzid, Ref<EVP_PKEY> key)
|
||||
: message1_{std::move(authcid)}
|
||||
, key_{std::move(key)}
|
||||
, stage_{0}
|
||||
{
|
||||
if (not authzid.empty()) {
|
||||
message1_.push_back(0);
|
||||
message1_.append(authzid);
|
||||
}
|
||||
}
|
||||
|
||||
auto mechanism_name() const -> std::string override
|
||||
{
|
||||
return "ECDSA-NIST256P-CHALLENGE";
|
||||
}
|
||||
|
||||
auto step(std::string_view msg) -> StepResult override;
|
||||
|
||||
auto is_complete() const -> bool override
|
||||
{
|
||||
return stage_ == 2;;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user