CRC error

flapflap flapflap at riseup.net
Mon Jul 28 08:25:43 CEST 2014


Hi,

pedro.markov at ml1.net:
> I'm a new user to the GPG world, and i haven't find information
> about the "CRC" error when importing a key.
> 
> What does CRC means?
I don't know the details for GnuPG, but CRC stands for Cyclic Redundancy
Check
  https://en.wikipedia.org/wiki/Cyclic_redundancy_check
CRC is an easy to compute "check sum" - it allows you to detect errors
in a dataset. Your data could be split into two parts: a stream of bits
for real data (payload), and a fixed amount of CRC bits (seems to be 3
bytes/24 bits here).
The transmitter of a message computes the CRC on the payload to be send,
then sends the payload and the result of the CRC calculation.
The receiver also computes the CRC code for the data and compares it
with the the one received. If they do not match, the transmitted data
was somehow damaged (e.g. some bits flipped, noisy channel). (*)
> 
> When importing a corrupted key the following message apears:
> gpg: CRC error; 9BAD9F - 00F1D7
> gpg: read_block: read error: invalid keyring
> gpg: import from `key' failed: invalid keyring
> gpg: Total number processed: 0
>
> I would like to know what does 9BAD9F - 00F1D7 means. Is is
> possible to fix a corrupted key?
I guess one of the two values is the one stored in the key file, and the
other one GnuPG expects it to be with the given data. As they mismatch,
there's some data consistency problem with the key ("corrupted key").
CRC only allows error detection, but _no_ error correction. So no, you
cannot fix/reconstruct a corrupted key.
> 
> Is is possible to know wich line of a corrupted key is wrong?
That has to answer someone with more knowledge in the GnuPG file format.
I guess there are several records/blocks that each have a CRC. If so, it
is possible to determine the damaged block (but not where in the block),
but I'd say that it's not easily doable.

(*) The explanation is a bit simplified: Usually a receiver computes the
CRC for the _payload and the CRC_, i.e. everything received. If the data
is valid, the computed CRC should be 0, if it is not 0, the data is
damaged. But basically it's the same as computing the CRC for the
payload only and comparing it with the received CRC.

~flapflap





More information about the Gnupg-users mailing list