1 #ifndef OPCUABRIDGE_SIGNATURE_H_ 2 #define OPCUABRIDGE_SIGNATURE_H_ 14 const std::string& getKeyid()
const {
return keyid_; }
15 void setKeyid(
const std::string& keyid) { keyid_ = keyid; }
16 const SignatureMethod& getMethod()
const {
return method_; }
17 void setMethod(
const SignatureMethod& method) { method_ = method; }
18 const Hash& getHash()
const {
return hash_; }
19 void setHash(
const Hash& hash) { hash_ = hash; }
20 const std::string& getValue()
const {
return value_; }
21 void setValue(
const std::string& value) { value_ = value; }
23 Json::Value wrapMessage()
const {
25 v[
"keyid"] = getKeyid();
26 v[
"method"] =
static_cast<Json::Value::Int
>(getMethod());
27 v[
"hash"] = getHash().wrapMessage();
28 v[
"sig"] = getValue();
31 void unwrapMessage(Json::Value v) {
32 setKeyid(v[
"keyid"].asString());
33 setMethod(static_cast<SignatureMethod>(v[
"method"].asInt()));
35 h.unwrapMessage(v[
"hash"]);
37 setValue(v[
"sig"].asString());
42 SignatureMethod method_{};
47 #ifdef OPCUABRIDGE_ENABLE_SERIALIZATION 48 SERIALIZE_FUNCTION_FRIEND_DECLARATION
50 DEFINE_SERIALIZE_METHOD() {
51 SERIALIZE_FIELD(ar,
"keyid_", keyid_);
52 SERIALIZE_FIELD(ar,
"method_", method_);
53 SERIALIZE_FIELD(ar,
"hash_", hash_);
54 SERIALIZE_FIELD(ar,
"value_", value_);
56 #endif // OPCUABRIDGE_ENABLE_SERIALIZATION 60 #endif // OPCUABRIDGE_SIGNATURE_H_