Backing up your PGP key by hand

Matt Borja me at mattborja.dev
Fri May 6 02:25:56 CEST 2022


The EEPROM notes are intriguing to me, and if that's an option you're
considering, I went ahead and tossed up some old code onto a gist if you're
interested. It's a crude example of storing PGP private key in flash (vs.
SRAM) using a little PROGMEM hack for the Arduino Uno:

https://u25119845.ct.sendgrid.net/ls/click?upn=AWAj65NY2UMz4TnmUvFN9IGbt1wm4vdbS70yUSppRsMQ5onvQAvzfk4AuG3VBsPrYrmXvCsmH2gOu2hhCVW-2FozFc-2BAJFdnKEEvcyDaqRDNxw2t1swznhe-2Byz9n3cIPh4tmtJZbbj4eNxHx3QmzfV8g-3D-3DkevG_RtEKULAgbs8GArutgsfJQJI1lr9pAjJUwpaVhpathDIPfe3Pjl-2BQZwS7yBZWMJnI-2F-2BW07si5qDvsgMp1WUyDq-2B7vWDN2JV-2B4L1ZHecivxc22dKrcUB5cbcYyYTx8pSJa9w8VTiC2AC3sotGpusq4jw-2Fk6gDJpa-2Bcmm9lMKhxfF7NTRoVvExf2glKlYOeM4S8OAO-2BJfbidgUYdi7zYOI-2BuQ-3D-3D

See also:

   -
   https://u25119845.ct.sendgrid.net/ls/click?upn=AWAj65NY2UMz4TnmUvFN9AQx4M1sn44MZVITLdjuhzbIZb0aXoHDzv0QZtQTVn5G6QeOWF0rMBkEnPOq-2Fj-2F-2Ff7zu1OGBDd7QcTgBhRzyDH6BBXC0wtfcDwuVmYeObvg6coI4_RtEKULAgbs8GArutgsfJQJI1lr9pAjJUwpaVhpathDIPfe3Pjl-2BQZwS7yBZWMJnI9hF-2FGHq3ueUG6rxidtqSlsMCnF4a-2B-2Fr0wPhEd3WHKLWjkHUB0NZN3Qd4o6hmF1WG7byhUwE-2FVIlacXPQ2PV2ji4Pw-2FnqpZqwNiGNXiZvjHvoIVtnoWv1Q6CYweQNM2VOCkazeKdCoN9nbWb6598Ivg-3D-3D
   -
   https://u25119845.ct.sendgrid.net/ls/click?upn=AWAj65NY2UMz4TnmUvFN9D9Ta4eWZgsvBZTPHn95mwzOn9PJbOBmsTVroNkfZhHrDU5DGuJrYEOd2BgJLlbEzuoN-2BAHGFNFVmOtv5a8BCVv8CDiB2IuRiauAKIGu9bRICNOG_RtEKULAgbs8GArutgsfJQJI1lr9pAjJUwpaVhpathDIPfe3Pjl-2BQZwS7yBZWMJnIOMlScXfFpwRqgzeOoj-2BzS0pUROFKpH-2FmjVM120PshB2I1tx18tpqjHo7CN-2BvYULJiJK8GYsZ56FlPmVQTHgFK9rztyCjsSTi7nHcWekonmfBpogDYpawqHUnKFJcMs-2FzFF5dKcFP5JVXWWtU-2BB2c2Q-3D-3D


I actually have another slightly more refined project sort of tabled until
I have more time freed up (maybe next couple weeks or so). It involves
allocating and managing zones on a much larger EEPROM space--available on a
single AT24C256C (32 KB up from 1 KB) which is also I2c, meaning you can
daisy chain about 8 of these out, if you want to get crazy. Latest
estimates I came up with suggested I could fit close to 2-3 4096-bit PGP
private keys on one of these things. And the implementation is much simpler
using the Wire.h interface
<https://u25119845.ct.sendgrid.net/ls/click?upn=AWAj65NY2UMz4TnmUvFN9AQx4M1sn44MZVITLdjuhzbIZb0aXoHDzv0QZtQTVn5Ge1KfTz6F6zMS-2FfP04-2Fjjt7iLi-2B-2BsXVWXxIkyqKKiRLAwROh2Z2sTwxGYJLPdBVaYH9Jw_RtEKULAgbs8GArutgsfJQJI1lr9pAjJUwpaVhpathDIPfe3Pjl-2BQZwS7yBZWMJnI0fwWUAB2MDwK37pLvF6ufO6iao-2FvXf08STW1gbf2HSikVG3H9JzlCvtxS5vZt6q0r0PVM5hLP1pPx6h4AHX-2Bl7fOjw8hA-2F24Gyg59SuUGesv14Wl6YvxHe11xr7Mamks9FN35tFf0BVodJ5Dpso3oA-3D-3D>
because
it actually has the room to store larger amounts of data without messing
around with PROGMEM. And it's all offline writing too :)

Ping me if you're interested. Otherwise, I'ma go back to what I was doing ;)

On Thu, May 5, 2022 at 4:58 PM Jacob Bachmeyer via Gnupg-users <
gnupg-users at gnupg.org> wrote:

> Lars Noodén via Gnupg-users wrote:
> > On 5/5/22 01:11, Jacob Bachmeyer wrote:
> > > Lars Noodén via Gnupg-users wrote:
> > >> A removable hard drive might be an option, if the storage time
> > >> is less than a decade and there are decent storage conditions
> > >> in regards to chemicals, temperature, humidity, and so on.  Flash
> > >> memory seems to lose
> > >> its charge rather quickly, measured in months.
> > >
> > > Write-once optical media is my preferred means of long-term backup for
> > > nontrivial amounts of data,
> > [snip]
> >
> > The number of years that the keys and the data they apply to will be
> > stored unpowered, offline will influence which storage medium is
> > acceptable for the task.
> >
> > Old CD-R were short-lived garage from my experience, but certain models
> > of recently made CD-R should last a while even under slightly
> > non-optimal storage conditions before they start flipping bits.
>
> This depends on the quality of the media.  I first got a CD-R drive in
> the mid 2000s and have discs from back then that were still readable
> when I last looked at them a few years ago.  Admittedly, these have been
> stored under ordinary room conditions and protected in a disc binder or
> jewel cases and were not the "bargain basement" media that was also
> available at the time.  A friend once lamented having something like 3
> to 5 discs out of a 100-pack of "Great Quality" branded CD-R media that
> were actually usable; the rest were either rejected during burning or
> failed immediately upon readback.  It is doubtful that those "Great
> Quality" discs are still readable today.  There was a significant
> difference in price:  the discs I used (Maxell/Memorex/Verbatim name
> brands stand out thinking back) typically cost about $20 for a 50-pack
> or similar for a 100-pack if on sale, while "Great Quality" was $5 for
> 100.  You really did get what you paid for, however.
>
> There were also direct-write DVD-R camcorders fairly popular in the mid
> to late 2000s.  I remember news stories about most of Barack Obama's
> earlier speeches having been lost before his first term as US President
> had ended because the only recordings had been made by his supporters
> using those camcorders and cheap DVD-R media that did not last.
>
>
> Note that "nontrivial amounts of data" excludes PGP keys; even a
> mini-CD-R holds several megabytes.  I will admit that lack of a
> reasonable backup strategy is one of the reasons I do not presently use
> PGP for encryption.
>
> > [...]
> >
> > Whether that bit flip hits anything important is another matter, but
> > they do add up over time and with enough of them they will eventually
> > hit something, worse if it hit something compressed.  [...]
>
> CD-ROM format has considerable data expansion.  If I remember correctly,
> a 650MB data CD actually stores something like 2.1GB after applying the
> various ECC layers.  There are quite a few bits to flip before anything
> is affected.
>
> > Air pollution, temperature, light, and humidity are some of the factors
> > affecting the lifespan of the physical storage medium.
>
> One of the advantages of optical media generally is that the discs are
> (supposed to be) sealed against their environment.  Absent extremes,
> (polycarbonate has a melting point, the data is written using very
> intense light that locally heats the dye layer) environmental effects
> should be minimal.  Along these lines, while fire will obviously destroy
> optical media, discs should remain readable after being in a flood, for
> example.  (Some mold removal may be needed, and the data should be
> copied to new media in case mold or the chemicals used to remove it
> adversely affect the integrity of the environmental seal.)
>
> > > I have SD cards and USB sticks with data blocks last written
> > > many years ago and still readable.  Granted, I have never used
> > > low-end no-name
> > [snip]
> >
> > And by reading them, they have powered up and refreshed the charge.  The
> > problem applies to such flash storage devices which have been left
> > unpowered for longer periods of time.
>
> No, it does not.  That is not how flash memory works.  Some flash
> translation layers might do such things in some devices, but I strongly
> doubt that flash-based microcontrollers have undocumented hardware
> functions to periodically rewrite the program storage, for example.  In
> any case, I have both USB sticks and SD cards that have been left
> entirely unpowered for years and found the data to still be there,
> certainly much longer than the "few months" you mentioned earlier.
>
> Theoretically, the stored charge does eventually leak off of the
> floating gate, but EEPROMs (and flash, which is essentially the same
> technology) are generally considered to hold data indefinitely.  The
> data retention specifications are based on "accelerated aging" tests,
> which generally involve elevated temperature.  The processes involved
> are highly nonlinear with respect to temperature and may very easily
> require centuries at room temperature or not occur at all without
> elevated temperatures; we do not know because flash storage is only now
> reaching the milestone of having existed long enough for even the oldest
> imprints to be reaching even the "accelerated aging" estimated
> lifespan.  So far, we are not seeing catastrophic losses of data stored
> in flash.
>
>
> -- Jacob
>
> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users at gnupg.org
> https://u25119845.ct.sendgrid.net/ls/click?upn=AWAj65NY2UMz4TnmUvFN9EYEqtNOGKM5EVTRJHzYauGZHQfmaLnBrHl5qgXgVVD7oMr9xT2-2FmICVLCVAwlw5rA-3D-3DZSQ7_RtEKULAgbs8GArutgsfJQJI1lr9pAjJUwpaVhpathDIPfe3Pjl-2BQZwS7yBZWMJnIaNZeES-2FvuI8enVsZnpzCQAeAMQ9aToEqX6In0wGW1siKL45MfHjp8-2FjKMYhbvzs9hYtBseE3UnkmINIAjCLkRsjw8zjCTbus64Kmm3oQWj3mtQb1m19-2FthQp3f5ruMZR1oHrAhH7mn4OWHh0UbsUig-3D-3D
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20220506/22326a8b/attachment-0001.html>


More information about the Gnupg-users mailing list