{"id":13408605,"url":"https://github.com/intra2net/paperbackup","last_synced_at":"2026-01-17T07:21:32.230Z","repository":{"id":17787650,"uuid":"82683594","full_name":"intra2net/paperbackup","owner":"intra2net","description":"Create a pdf with barcodes to backup text files on paper. Designed to backup ASCII-armored GnuPG and SSH key files and ciphertext.","archived":false,"fork":false,"pushed_at":"2024-03-18T03:43:02.000Z","size":118,"stargazers_count":135,"open_issues_count":12,"forks_count":17,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-07-31T20:31:32.610Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/intra2net.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-21T13:36:06.000Z","updated_at":"2024-06-07T12:55:30.000Z","dependencies_parsed_at":"2024-01-07T21:02:09.510Z","dependency_job_id":"6eef2cf7-ced9-4c76-be58-25071384240e","html_url":"https://github.com/intra2net/paperbackup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/intra2net/paperbackup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intra2net%2Fpaperbackup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intra2net%2Fpaperbackup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intra2net%2Fpaperbackup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intra2net%2Fpaperbackup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intra2net","download_url":"https://codeload.github.com/intra2net/paperbackup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intra2net%2Fpaperbackup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28503606,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:00:54.022Z","updated_at":"2026-01-17T07:21:32.211Z","avatar_url":"https://github.com/intra2net.png","language":"Python","funding_links":[],"categories":["\u003ca name=\"backup\"\u003e\u003c/a\u003eBackup","Python","others"],"sub_categories":[],"readme":"# paperbackup.py\n\nCreate a pdf with barcodes to backup text files on paper.\nDesigned to backup ASCII-armored GnuPG and SSH key files and ciphertext.\n\n## How to use\n\n###### Backup\n\n```\ngpg2 --armor --export-options export-minimal --export-secret-key \"User Name\" \u003ekey.asc\npaperbackup.py key.asc\npaperrestore.sh key.asc.pdf | diff key.asc -\nlpr key.asc.pdf\n```\n\nThis will print out the public and private key of \"User Name\". The\nprivate key is still encrypted with it's passphrase, so make sure\nyou don't lose or forget it.\n\nSee some example output here:\nhttps://github.com/intra2net/paperbackup/raw/master/example_output.pdf\n\n###### Restore\n\n1. Scan the papers\n2. Create one file containing all the pages. zbar supports e.g. PDF, TIFF, PNG, JPG,...\n3. `paperrestore.sh scanned.pdf \u003ekey.asc`\n4. `gpg2 --import key.asc`\n\nIf one or more barcodes could not be decoded, try scanning them again. If that does\nnot work, type in the missing letters from the plaintext output at the end of the pdf.\n\n## Dependencies\n\n- python 3 https://www.python.org/\n- python3-pillow https://python-pillow.org/\n- PyX http://pyx.sourceforge.net/\n- LaTeX (required by PyX) https://www.latex-project.org/\n- python3-qrencode https://github.com/Arachnid/pyqrencode\n- enscript https://www.gnu.org/software/enscript/\n- ghostscript https://www.ghostscript.com/\n- ZBar http://zbar.sourceforge.net/\n\n## Why backup on paper?\n\nSome data, like GnuPG or SSH keys, can be really really important for you, like that your whole\nbusiness relies on them. If that is the case, you should have multiple backups at multiple\nplaces of it.\n\nI also think it is a good idea to use different media types for it. Hard disks, flash based\nmedia and CD-R are not only susceptible to heat, water and strong EM waves, but also age.\n\nPaper, if properly stored, has proven to be able to be legible after centuries. It is also\nquite resistant to fire if stored as a thick stack like a book.\n\nSo I think it is a good idea to throw a backup on paper into the mix of locations and media\ntypes of your important backups.\n\nStoring the paper backup in a machine readable format like barcodes makes it practical to restore\neven large amounts in short order. If the paper is too damaged for the barcodes to be readable,\nyou still have the printed plaintext that paperbackup produces.\n\n## How to properly store the paper\n\nThe ISO has some standards for preservation and long term storage of paper:\n\nISO/TC 46/SC 10 - Requirements for document storage and conditions for preservation\nhttp://www.iso.org/iso/home/store/catalogue_tc/catalogue_tc_browse.htm?commid=48842\n\nHere's an example of what ISO 16245 describes:\nhttp://www.iso.org/iso/livelinkgetfile-isocs?nodeId=15011261\n\n## Choice and error resilency of barcodes\n\nOnly 2D barcodes have the density to make key backup practical. QR Code and DataMatrix are\nthe most common 2D barcodes.\n\nUsing a common barcode symbology makes sure that there are several independent implementations\nof decoders available. This increases the probability that they handle defects and error\ncorrection differently and are able to tolerate different kinds of defects. So if the barcode\ngets damaged, you have several programs you can try.\n\nSeveral papers comparing QR and DataMatrix come to the conclusion that DataMatrix allows\na higher density and offers better means for error correction. I tested this and came\nto the conclusion that the QR code decoding programs available to me had better error\nresilency than the ones for DataMatrix.\n\nThe toughest test I found, other than cutting complete parts from a code, was printing \nthe code, scanning it, printing the scanned image on a pure black and white printer \nand then repeating this several times. While the barcode still looks good to the human\neye, this process slightly deforms the barcode in an irregular pattern.\n\nlibdmtx was still able to decode a DataMatrix barcode with 3 repetitions of the above\nprocedure. A expensive commercial library was still able to decode after 5 repetitions.\n\nZBar and the commercial library could still decode a QR code after 7 repetitions.\n\nA laser printed QR code, completely soaked in dirty water for a few hours, rinsed with\nclean water, dried and then scanned, could be decoded by ZBar on the first try.\n\nThis is why I chose QR code for this program.\n\n## Encoding and data format\n\nIn my tests I found that larger QR codes are more at risk to becoming undecodable due to\nwrinkles and deformations of the paper. So paperbackup splits the barcodes at 140 bytes of data.\n\nQR codes offer a feature to concatenate the data of several barcodes. As this is not supported\nby all programs, I chose not to use it.\n\nEach barcode is labeled with a start marker `^\u003csequence number\u003e\u003cspace\u003e`. After that the raw\nand otherwise unencoded data follows.\n\n## Plaintext output\n\npaperbackup prints the plaintext in addition to the QR codes. If decoding one or more barcodes\nshould fail, you can use it as fallback.\n\nTo ease entering large amounts of \"gibberish\" like base64 data, each line is printed with\na checksum. The checksum is the first 6 hexadecimal characters of MD5 sum of the line content.\nThe MD5 is on the \"pure\" line content without the line break (e.g. \\n or \\r\\n)\n\nTo verify a line checksum use\n`echo -n \"line content\" | md5sum | cut -c -6`\n\nIf a line is too long to be printed on paper, it is split. This is denoted by a \"^\" character\nat the begin of the next line on paper. The \"^\" is not included in the checksum.\n\n## Changing the paper format\n\nThe program writes PDFs in A4 by default. You can uncomment the respective lines\nin the constants section of the source to change to US Letter.\n\n## Similar projects\n\n###### paperbackup with reportlab backend https://github.com/tuxlifan/paperbackup\n\nShould behave the same as this paperbackup but with using reportlab instead of PyX/LaTeX for PDF generation.\nAny discrepancies should be filed at https://github.com/tuxlifan/paperbackup/issues\n\n###### PaperBack http://ollydbg.de/Paperbak/ and https://github.com/Rupan/paperbak/\n\nAlthough it is GPL 3, this original version **PaperBack** (program 8-character name PaperBak) is for Windows only (but in 2018 a crossplatform, backwards-compatible, command line version paperbak-cli has been published, see next entry). It uses it's own proprietary barcode type. That allows it to produce much more dense code, but in case of a problem with decoding you are on your own.\n\n###### paperback-cli https://git.teknik.io/scuti/paperback-cli\n\nPaperback-cli is the crossplatform, backwards-compatible, command line version of Oleh Yuschuk's PaperBack. https://github.com/Wikinaut/paperback-cli is a copy on github. See discussion on https://github.com/Rupan/paperbak/issues/1 for further programs.\n\n###### ColorSafe https://github.com/colorsafe/colorsafe\n\nA data matrix for printing on paper. Inspired by PaperBak, ColorSafe is written with modern methods and technologies and is cross-platform. It aims to allow a few Megabytes of data (or more) to be stored on paper for a worst case scenario backup, for extremely long-term archiving, or just for fun. With best practices, ColorSafe encoded data can safely withstand the viccissitudes of technology changes over long periods of time.\n\n###### Twibright Optar http://ronja.twibright.com/optar/\n\nUses the not-so-common Golay code to backup 200KB per page. So it offers a much higher\ndensity than paperbackup.py, but is probably more affected by defects on the paper.\nGPL 2 and designed for Linux.\n\n###### Paperkey http://www.jabberwocky.com/software/paperkey/\n\nIt is designed to reduce the data needed to backup a private GnuPG key. It does not help you\nto print and scan the data. So it could be used in addition to paperbackup.py.\n\n###### asc2qr.sh https://github.com/4bitfocus/asc-key-to-qr-code\n\nVery similar to paperbackup.py. But it only outputs .png images without ordering information.\nSo you have to arrange printing and ordering yourself.\n\n## License\n\nMIT X11 License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintra2net%2Fpaperbackup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintra2net%2Fpaperbackup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintra2net%2Fpaperbackup/lists"}