aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/tls/tls_policy.h3
-rw-r--r--src/lib/tls/tls_text_policy.cpp11
2 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/tls/tls_policy.h b/src/lib/tls/tls_policy.h
index 463f1c6d6..333cf0ee1 100644
--- a/src/lib/tls/tls_policy.h
+++ b/src/lib/tls/tls_policy.h
@@ -519,6 +519,9 @@ class BOTAN_PUBLIC_API(2,0) Text_Policy : public Policy
std::string get_str(const std::string& key, const std::string& def = "") const;
+ bool set_value(const std::string& key, const std::string& val, bool overwrite);
+
+ private:
std::map<std::string, std::string> m_kv;
};
diff --git a/src/lib/tls/tls_text_policy.cpp b/src/lib/tls/tls_text_policy.cpp
index 6b3b5af1d..ef5799339 100644
--- a/src/lib/tls/tls_text_policy.cpp
+++ b/src/lib/tls/tls_text_policy.cpp
@@ -252,6 +252,17 @@ std::string Text_Policy::get_str(const std::string& key, const std::string& def)
return i->second;
}
+bool Text_Policy::set_value(const std::string& key, const std::string& val, bool overwrite)
+ {
+ auto i = m_kv.find(key);
+
+ if(overwrite == false && i != m_kv.end())
+ return false;
+
+ m_kv.insert(i, std::make_pair(key, val));
+ return true;
+ }
+
}
}