aboutsummaryrefslogtreecommitdiffstats
path: root/src/pem.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-07-01 21:09:54 +0000
committerlloyd <[email protected]>2006-07-01 21:09:54 +0000
commit6d3a4de1efcb6b04a1ab87037d487f979d7ca445 (patch)
tree02342b193a3808d2010b441480f65aa45a23dc92 /src/pem.cpp
parent3d1d14cf405111e30643cf4c7674d441cc07a2e0 (diff)
Access the global configuration through an object reference instead
of stand-alone functions. Store the configuration in a distinct object, rather than just a map inside the library state.
Diffstat (limited to 'src/pem.cpp')
-rw-r--r--src/pem.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/pem.cpp b/src/pem.cpp
index 9a0f3c31e..aec036cb4 100644
--- a/src/pem.cpp
+++ b/src/pem.cpp
@@ -17,7 +17,7 @@ namespace PEM_Code {
*************************************************/
std::string encode(const byte der[], u32bit length, const std::string& label)
{
- const u32bit PEM_WIDTH = Config::get_u32bit("pem/width");
+ const u32bit PEM_WIDTH = global_config().option_as_u32bit("pem/width");
if(PEM_WIDTH < 50 || PEM_WIDTH > 76)
throw Encoding_Error("PEM: Invalid line width " + to_string(PEM_WIDTH));
@@ -57,7 +57,8 @@ SecureVector<byte> decode_check_label(DataSource& source,
*************************************************/
SecureVector<byte> decode(DataSource& source, std::string& label)
{
- const u32bit RANDOM_CHAR_LIMIT = Config::get_u32bit("pem/forgive");
+ const u32bit RANDOM_CHAR_LIMIT =
+ global_config().option_as_u32bit("pem/forgive");
const std::string PEM_HEADER1 = "-----BEGIN ";
const std::string PEM_HEADER2 = "-----";
@@ -117,7 +118,9 @@ SecureVector<byte> decode(DataSource& source, std::string& label)
*************************************************/
bool matches(DataSource& source, const std::string& extra)
{
- const u32bit PEM_SEARCH_RANGE = Config::get_u32bit("pem/search");
+ const u32bit PEM_SEARCH_RANGE =
+ global_config().option_as_u32bit("pem/search");
+
const std::string PEM_HEADER = "-----BEGIN " + extra;
SecureVector<byte> search_buf(PEM_SEARCH_RANGE);