TPK Archival

David Shaw dshaw at
Tue Mar 24 17:06:13 CET 2009

On Tue, Mar 24, 2009 at 02:47:01PM +0100, Chris Hills wrote:

> I am looking for a tool that to export a GPG private key to a Data  
> Matrix 2d barcode for long-term archival. I have been searching but have  
> yet to find any existing software to do this. I have looked at PaperKey  
> but it only produces an ascii representation which is not optimized for  
> machine-reading. My preferred output formats are PDF/EPS/SVG. If such  
> software does not already exist, I would appreciate a pointer on how to  
> make something myself, perhaps using the binary output from PaperKey.

Try something like this.

To encode:

  gpg --export-secret-key (thekey) | paperkey --output-type raw | dmtxwrite -e8 -f pdf > my_pdf_file.pdf

You can pass pdf, eps, svg, etc, to the -f option.  Use 'dmtxwrite -l'
to get a list of all supported image formats.

To decode:

  dmtxread -N1 my_pdf_file.pdf | paperkey --pubring ~/.gnupg/pubring.gpg > my_new_secret_key.gpg

dmtxread and dmtxwrite are part of the very clever libdmtx package at

I've actually been toying with building Data Matrix support directly
into paperkey (using libdmtx), but it's not clear what the point is
when dmtxread and dmtxwrite are so easy to use.


More information about the Gnupg-users mailing list