<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Passing Curiosity: Posts tagged accounting</title>
    <link href="https://passingcuriosity.com/tags/accounting/accounting.xml" rel="self" />
    <link href="https://passingcuriosity.com" />
    <id>https://passingcuriosity.com/tags/accounting/accounting.xml</id>
    <author>
        <name>Thomas Sutton</name>
        
        <email>me@thomas-sutton.id.au</email>
        
    </author>
    <updated>2024-01-04T00:00:00Z</updated>
    <entry>
    <title>Ledger accounting with GnuPG</title>
    <link href="https://passingcuriosity.com/2024/ledger-with-gnupg/" />
    <id>https://passingcuriosity.com/2024/ledger-with-gnupg/</id>
    <published>2024-01-04T00:00:00Z</published>
    <updated>2024-01-04T00:00:00Z</updated>
    <summary type="html"><![CDATA[<p><a href="https://ledger-cli.org/">Ledger</a> has <a href="https://github.com/ledger/ledger/pull/1949">support for GnuPG-encrypted journal files</a> but it’s not
really documented anywhere that I’ve been able to find. To check that it’s
enabled in your build, consult the version message:</p>
<pre><code>$ ledger --version
Ledger 3.3.2-20230330, the command-line accounting tool
with support for gpg encrypted journals and without Python support

Copyright (c) 2003-2023, John Wiegley.  All rights reserved.

This program is made available under the terms of the BSD Public License.
See LICENSE file included with the distribution for details and disclaimer.</code></pre>
<p>and check for “with support for gpg encrypted journals”.</p>
<p>If it’s present, then all you have to do is encrypt your journal files and
<code>ledger</code> will transparently decrypt the data as it reads. Doing this is a
simple matter of encrypting the files with yourself as the recipient. If you
only use <code>gpg --encrypt</code> to encrypt files for yourself (and not to send to
other people) then the easiest way might be to configure GnuPG to encrypt with
your own key by default:</p>
<pre><code>$ echo default-recipient-self &gt;&gt; ~/.gnupg/gpg.conf</code></pre>
<p>Alternatively, you can remember to pass the <code>--recipient</code> argument specifying
the key ID or email address for your own key when you run <code>gpg --encrypt</code>.</p>
<p>Now you can just create some encrypted journal files:</p>
<pre><code>$ cat 2024.journal | gpg --encrypt --armor &gt; 2024.journal.gpg
$ ledger -f 2024.journal.gpg bal
        AUD 2,187.50  Assets
        AUD 2,150.00    Bank
           AUD 37.50    Cash
           AUD 12.50  Expenses:Food:Dining
       AUD -2,200.00  Income:Gifts
--------------------
                   0</code></pre>
<p>For the sake of convenience, I give the encrypted files an extension like <code>.asc</code>
or <code>.gpg</code> so that tools like <a href="https://github.com/jamessan/vim-gnupg">vim-gnupg</a> can transparently decrypt them for
editing.</p>
<p>Ledger handles encryption transparently at the file-access level, so you
can split up your configuration and journal postings into different
files and make each encrypted or unencrypted as you like. Personally, I
like to have a single plain-text file that defines my chart of accounts
and then includes encrypted journal files containing the actual posting.</p>]]></summary>
</entry>

</feed>
