aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/datastor
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-06-13 18:06:57 +0000
committerlloyd <[email protected]>2012-06-13 18:06:57 +0000
commit6dc2f28174e110427899727690c82a8d230c908e (patch)
tree0d092b56dd740b15552b211a2f9b7ffd50d59964 /src/utils/datastor
parent9644a3ecebb15d8241e65dcae63bd6d0382a95a6 (diff)
Add support (decoding only) for the CRL Distribution Point extension.
Diffstat (limited to 'src/utils/datastor')
-rw-r--r--src/utils/datastor/datastor.cpp16
-rw-r--r--src/utils/datastor/datastor.h5
2 files changed, 19 insertions, 2 deletions
diff --git a/src/utils/datastor/datastor.cpp b/src/utils/datastor/datastor.cpp
index d32c4787e..7563e9309 100644
--- a/src/utils/datastor/datastor.cpp
+++ b/src/utils/datastor/datastor.cpp
@@ -64,13 +64,27 @@ std::string Data_Store::get1(const std::string& key) const
std::vector<std::string> vals = get(key);
if(vals.empty())
- throw Invalid_State("Data_Store::get1: Not values for " + key);
+ throw Invalid_State("Data_Store::get1: No values set for " + key);
if(vals.size() > 1)
throw Invalid_State("Data_Store::get1: More than one value for " + key);
return vals[0];
}
+std::string Data_Store::get1(const std::string& key,
+ const std::string& default_value) const
+ {
+ std::vector<std::string> vals = get(key);
+
+ if(vals.size() > 1)
+ throw Invalid_State("Data_Store::get1: More than one value for " + key);
+
+ if(vals.empty())
+ return default_value;
+
+ return vals[0];
+ }
+
/*
* Get a single std::vector atom
*/
diff --git a/src/utils/datastor/datastor.h b/src/utils/datastor/datastor.h
index b471f85e1..1c0504fc9 100644
--- a/src/utils/datastor/datastor.h
+++ b/src/utils/datastor/datastor.h
@@ -33,7 +33,10 @@ class BOTAN_DLL Data_Store
std::vector<std::string> get(const std::string&) const;
- std::string get1(const std::string&) const;
+ std::string get1(const std::string& key) const;
+
+ std::string get1(const std::string& key,
+ const std::string& default_value) const;
std::vector<byte> get1_memvec(const std::string&) const;
u32bit get1_u32bit(const std::string&, u32bit = 0) const;