GnuPG: representações de IDs chave e impressões digitais

3

Na man page de gpg , há exemplos de IDs de chave:

234567C4
0F34E556E
01347A56A
0xAB123456

234AABBCC34567C4
0F323456784E56EAB
01AB3FED1347A5612
0x234AABBCC34567C4

e impressões digitais:

1234343434343434C434343434343434
123434343434343C3434343434343734349A3434
0E12343434343434343434EAB3484343434343434
0xE12343434343434343434EAB3484343434343434

Minha intuição teria sido que um 0 líder é para octal e um 0x principal para hexadecimal, mas não parece ser assim.

Quais são as diferentes representações?

    
por Gradient 14.02.2014 / 11:42

2 respostas

2

NOTA: Antes de começar, todas as representações aqui são apenas hexadecimais. Não há outra representação.

IDs de chave

A página man parece bem clara sobre a origem desses valores. Os IDs principais são uma parte da impressão digital SHA-1.

The key Id of an X.509 certificate are the low 64 bits of its SHA-1 fingerprint. The use of key Ids is just a shortcut, for all automated processing the fingerprint should be used.

Todos esses valores são hexadecimais, a notação permite que um número seja prefixado com 0x , a 0 ou simplesmente comece com um valor diferente de zero.

OBSERVAÇÃO: O uso de IDs de chave é inerentemente uma má ideia, pois eles basicamente tiram uma parte da impressão digital para identificar uma determinada chave. O problema surge em que é um pouco trivial gerar colisões entre IDs de chave. Veja este artigo para saber mais sobre esse assunto, intitulado: IDs de chave curta são ruins notícias (com OpenPGP e GNU Privacy Guard) .

trecho

Summary: It is important that we (the Debian community that relies on OpenPGP through GNU Privacy Guard) stop using short key IDs. There is no vulnerability in OpenPGP and GPG. However, using short key IDs (like 0x70096AD1) is fundementally insecure; it is easy to generate collisions for short key IDs. We should always use 64-bit (or longer) key IDs, like: 0x37E1C17570096AD1 or 0xEC4B033C70096AD1.

TL;DR: This now gives two results: gpg --recv-key 70096AD1

Impressões digitais

Considerando as impressões digitais:

This format is deduced from the length of the string and its content or the 0x prefix. Note, that only the 20 byte version fingerprint is available with gpgsm (i.e. the SHA-1 hash of the certificate).

When using gpg an exclamation mark (!) may be appended to force using the specified primary or secondary key and not to try and calculate which primary or secondary key to use.

The best way to specify a key Id is by using the fingerprint. This avoids any ambiguities in case that there are duplicated key IDs.

Sugiro dar uma olhada na página da Wikipédia intitulada: Impressão digital da chave pública . Ele detalha como as impressões digitais são geradas. Aqui está o resumo:

trecho
  1. A public key (and optionally some additional data) is encoded into a sequence of bytes. To ensure that the same fingerprint can be recreated later, the encoding must be deterministic, and any additional data must be exchanged and stored alongside the public key. The additional data is typically information which anyone using the public key should be aware of. Examples of additional data include: which protocol versions the key should be used with (in the case of PGP fingerprints); and the name of the key holder (in the case of X.509 trust anchor fingerprints, where the additional data consists of an X.509 self-signed certificate).

  2. The data produced in the previous step is hashed with a cryptographic hash function such as MD5 or SHA-1.

  3. If desired, the hash function output can be truncated to provide a shorter, more convenient fingerprint.

This process produces a short fingerprint which can be used to authenticate a much larger public key. For example, whereas a typical RSA public key will be 1024 bits in length or longer, typical MD5 or SHA-1 fingerprints are only 128 or 160 bits in length.

When displayed for human inspection, fingerprints are usually encoded into hexadecimal strings. These strings are then formatted into groups of characters for readability. For example, a 128-bit MD5 fingerprint for SSH would be displayed as follows:

   43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8

Referências

por 14.02.2014 / 12:27
2

O prefixo 0x determina que o seguinte é um ID curto, um ID longo ou uma impressão digital.

Pelo menos com o GnuPG 2.0.22 isso parece não fazer nenhuma diferença (eu não sei se isso sempre foi o caso). Se você usar uma sequência de seleção que se parece com uma ID curta, ID longa ou impressão digital, ela será ignorada como uma string de pesquisa de texto. Você pode colocar 12345678 em um ID de usuário, mas

gpg --list-keys 12345678

não mostrará esse certificado. Mas

gpg --list-keys 1234567

vai.

    
por 14.02.2014 / 13:25