- Package:
- zbar-tools
- Source:
- zbar
- Description:
- QR code / bar code scanner and decoder (utilities)
- Submitter:
- Sam Morris
- Date:
- 2021-05-24 21:15:18 UTC
- Severity:
- normal
$ gpg --export-secret-key 5EA01078 | paperkey --output-type raw | ascii85 | qrencode -8 -o key.png $ zbarimg key.png QR-Code: scanned 1 barcode symbols from 1 images in 0.1 seconds The image can be decoded with qtqr, so I am assuming qrencode is doing the right thing here. I'm only 99% sure because, while qtqr is not able to save the decoded data in uninterpreted form anywhere, it doesn't indicate an error while decoding. - -- System Information: Debian Release: jessie/sid APT prefers testing APT policy: (540, 'testing'), (530, 'unstable'), (520, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages zbar-tools depends on: ii libc6 2.17-3 ii libgomp1 4.8.0-7 ii libjpeg8 8d-1 ii libmagickcore5 8:6.7.7.10-5 ii libmagickwand5 8:6.7.7.10-5 ii libv4l-0 0.8.9-3 pn libzbar0 <none> zbar-tools recommends no packages. zbar-tools suggests no packages. - -- no debconf information iEYEARECAAYFAlGjXu4ACgkQshl/216gEHhYZgCg2Lng4foRNX3OoA0kgJicbDOc J0YAoOvrirVkzOVarE7oQC+eqexL5YP/ =oMfm -----END PGP SIGNATURE-----
On Mon, 27 May 2013 14:26:06 +0100 Sam Morris wrote: > Package: zbar-tools -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > $ gpg --export-secret-key 5EA01078 | paperkey --output-type raw | ascii85 | qrencode -8 -o key.png > $ zbarimg key.png > QR-Code: > scanned 1 barcode symbols from 1 images in 0.1 seconds > > The image can be decoded with qtqr, so I am assuming qrencode is doing > the right thing here. I'm only 99�sure because, while qtqr is not able > to save the decoded data in uninterpreted form anywhere, it doesn't > indicate an error while decoding. testing > APT policy: (540, 'testing'), (530, 'unstable'), (520, 'experimental') > Architecture: amd64 (x86_64) > Foreign Architectures: i386 > > Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores) > Locale: LANG
The maximum allowed size on a QR code is 3K, so trying to pass a 4K private key as proposed will cause qrencode to fail: $ gpg --export 5EA01078| ascii85 | qrencode -8 -o key.png Failed to encode the input data: Input data too large (ps.: I'm using --export, instead of --export-private-key, as I don't have the private key used by the bug report) Yet, we can use "head" command to truncate the size to something that would work. With that in mind, I did the following test with the upstream version of ZBar[1]: 1. ASCII mode: -------------- $ gpg --export 5EA01078| ascii85| head -10 > orig && cat orig | qrencode -8 -o key.png && ./zbarimg/zbarimg --oneshot --raw key.png >parsed && diff -s orig parsed scanned 1 barcode symbols from 1 images in 0.05 seconds Files orig and parsed are identical 2. Binary mode: --------------- $ gpg --export 5EA01078 |head -c 2000 > orig && cat orig | qrencode -8 -o key.png && ./zbarimg/zbarimg -Sbinary --raw --oneshot key.png >parsed && diff -s orig parsed scanned 1 barcode symbols from 1 images in 0.11 seconds Files orig and parsed are identical Summary: -------- On both ASCII and binary mode, the output of the decoded image is equal to the input data. It should be noticed that, without "--oneshot", zbarimg will output a "\n" after the parsed data, as the image may have other codes on it. So, this issue was already solved upstream. [1] available at: https://github.com/mchehab/zbar Thanks, Mauro
This problem happens because ZBar always tries to convert
the binary data to text. If a character encoding is not specified,
it will try to automatically detect the encoding.
New versions of ZBar will have a binary decoding option.
Users of the zbarimg and zbarcam tools will be able to pass
this option to the QR decoder through the -Sqr.binary option,
or simply -Sbinary. There will also be a new one shot mode.
Passing --raw --oneshot to the ZBar tools will make them decode
exactly one barcode and output nothing but the data contained in it.
With these new features it should be possible to QR encode
secret keys in binary form:
$ gpg --export-secret-key $fingerprint \
| paperkey --output-type raw \
| qrencode --8bit --output secret-key.qr.png
Using the paperkey tool allows storing even 4096 bit RSA secret keys
in binary QR codes. They can be printed on paper and later restored
with zbarcam:
$ zbarcam --raw --oneshot -Sbinary \
| paperkey --pubring public-key.asc \
| gpg --import
Greeting to you once again I am writing for the second time as I did not receive any reply from you to my previous message. Kindly reply so we can discuss the subject as soon as possible. Sincerely, Andy Landman