summaryrefslogtreecommitdiff
path: root/src/context.h
diff options
context:
space:
mode:
authorMichael Raitza <spacefrogg-devel@meterriblecrew.net>2020-07-28 21:08:39 +0200
committerJohn Wiegley <johnw@newartisans.com>2020-10-30 10:08:00 -0700
commitf8e8cc160048cc7032254f1db7548c68571c3409 (patch)
treef9196d0624e1aa88924f4c0d33a767686026eba4 /src/context.h
parenteaf095ec3b0017f824cdbfe4e9e4bc42331d421a (diff)
downloadfork-ledger-f8e8cc160048cc7032254f1db7548c68571c3409.tar.gz
fork-ledger-f8e8cc160048cc7032254f1db7548c68571c3409.tar.bz2
fork-ledger-f8e8cc160048cc7032254f1db7548c68571c3409.zip
Implement cryptographic access to files using GPGME
Diffstat (limited to 'src/context.h')
-rw-r--r--src/context.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/context.h b/src/context.h
index ca7af060..bf97feb5 100644
--- a/src/context.h
+++ b/src/context.h
@@ -45,6 +45,10 @@
#include "utils.h"
#include "times.h"
+#if HAVE_GPGME
+#include "gpgme.h"
+#endif
+
namespace ledger {
class journal_t;
@@ -119,7 +123,11 @@ inline parse_context_t open_for_reading(const path& pathname,
_f("Cannot read journal file %1%") % filename);
path parent(filename.parent_path());
+#if HAVE_GPGME
+ shared_ptr<std::istream> stream(decrypted_stream_t::open_stream(filename));
+#else
shared_ptr<std::istream> stream(new ifstream(filename));
+#endif
parse_context_t context(stream, parent);
context.pathname = filename;
return context;