<commit_before>---
layout: post
title: The N9, QR-Codes, and KeePassX
date: 2012-01-08 22:27:50
categories: general keepass n9
---

*Update: I happened across a [KeePass
plugin](http://keepass.info/plugins.html#qrcodegen) (not the same as KeePassX)
that displays passwords as QR codes, just like my hack below.*

Poor, glorious N9.

It's impossible not to love the N9 if you're a geek, especially a programming,
bash-loving, Linux-hankering geek.  It's like a nerd talisman.  This post isn't
about the N9, specifically, so I'll save the love-fest for another time.

This post is about how difficult it can be to get text (especially passwords)
onto a smartphone securely.  I've come to like the approach of using QR codes.
Most (all?) smartphones have a barcode scanner, and QR codes are one of [many
convenient ways](http://en.wikipedia.org/wiki/Barcode) to encode text into an
image.  In the case of the N9, it's
[MeeScan](http://store.ovi.com/content/231518).

![meescan](/static/images/011/meescan.png)

[qrencode](http://fukuchi.org/works/qrencode/index.html.en) is an extremely
easy to use encoder.  Pass it a string, it produces an image.

{% highlight bash %}
qrencode "mypassword" -o mypass.png
{% endhighlight %}

[KeePassX](http://keepassx.org) is an excellent password manager.
Unfortunately...

![KeePassX not in N9](/static/images/011/keepass_not_in_n9.png)

Sadly, there is no KeePassX client on the N9.  At least, not yet.  Even if
there were, I'm skeptical that it's a good idea at all to be carrying around a
database of personal passwords on a smartphone.  It's encrypted, sure, but
touchscreen keyboards encourage weak passphrases.  Who wants to enter a 64+
character passphrase on a <abbr title="Virtual keyboard">vkbd</abbr>?

This evening, I spent about an hour hacking QR-code support into KeePassX.
It's a seriously messy hack, using
[system()](http://en.cppreference.com/w/cpp/utility/program/system) to call
`qrencode`, pass in the password, then call
[evince](http://projects.gnome.org/evince/?guid=ON) to view it.  Even worse, I
just tacked it onto the "Copy Password" function, instead of figuring out how
to create a new menu item.  It doesn't even delete the generated image after
viewing.  Definitely nothing more than a proof of concept.

Here it is in action.

<p><a href="/static/images/011/keepassx_demo.png"><static/images class="grid_7"
src="/static/images/011/keepassx_demo.png" alt="KeePassX generating a QR code" title=""<commit_msg>make keepassx n9 transparent png more visible<commit_after>---
layout: post
title: The N9, QR-Codes, and KeePassX
date: 2012-01-08 22:27:50
categories: general keepass n9
---

*Update: I happened across a [KeePass
plugin](http://keepass.info/plugins.html#qrcodegen) (not the same as KeePassX)
that displays passwords as QR codes, just like my hack below.*

Poor, glorious N9.

It's impossible not to love the N9 if you're a geek, especially a programming,
bash-loving, Linux-hankering geek.  It's like a nerd talisman.  This post isn't
about the N9, specifically, so I'll save the love-fest for another time.

This post is about how difficult it can be to get text (especially passwords)
onto a smartphone securely.  I've come to like the approach of using QR codes.
Most (all?) smartphones have a barcode scanner, and QR codes are one of [many
convenient ways](http://en.wikipedia.org/wiki/Barcode) to encode text into an
image.  In the case of the N9, it's
[MeeScan](http://store.ovi.com/content/231518).

![meescan](/static/images/011/meescan.png)

[qrencode](http://fukuchi.org/works/qrencode/index.html.en) is an extremely
easy to use encoder.  Pass it a string, it produces an image.

{% highlight bash %}
qrencode "mypassword" -o mypass.png
{% endhighlight %}

<p><a href="http://keepassx.org">KeePassX</a> is an excellent password manager.
Unfortunately&hellip;</p>

<div class="alert alert-success text-center">
<img src="/static/images/011/keepass_not_in_n9.png" alt="KeePassX not in N9" />
</div>

Sadly, there is no KeePassX client on the N9.  At least, not yet.  Even if
there were, I'm skeptical that it's a good idea at all to be carrying around a
database of personal passwords on a smartphone.  It's encrypted, sure, but
touchscreen keyboards encourage weak passphrases.  Who wants to enter a 64+
character passphrase on a <abbr title="Virtual keyboard">vkbd</abbr>?

This evening, I spent about an hour hacking QR-code support into KeePassX.
It's a seriously messy hack, using
[system()](http://en.cppreference.com/w/cpp/utility/program/system) to call
`qrencode`, pass in the password, then call
[evince](http://projects.gnome.org/evince/?guid=ON) to view it.  Even worse, I
just tacked it onto the "Copy Password" function, instead of figuring out how
to create a new menu item.  It doesn't even delete the generated image after
viewing.  Definitely nothing more than a proof of concept.

Here it is in action.

<p><a href="/static/images/011/keepassx_demo.png"><static/images class="grid_7"
src="/static/images/011/keepassx_demo.png" alt="KeePassX generating a QR code" title=""
{'fraction_non_alphanumeric': 0.10366574694521088, 'fraction_numerical': 0.01754040204966496, 'mean_word_length': 4.498374864572048, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1785703', 'n_tokens_mistral': 1745, 'n_tokens_neox': 1593, 'n_words': 649}