statistics example should count ECDH KDF parameters

ECDH public keys have a set of KDF parameters in their public key data.

It's defined as:

  • one octet of size (typically 3)
  • one octet of KDF version (only 1 is defined)
  • one octet of digest algo identifier (for the KDF)
  • one octet of symmetric cipher identifier (for the KEK)

it would be good if openpgp/examples/statistics.rs would count the variety of different KDF parameters encountered in a keydump.

The simplest thing would be:

  • as a denominator, accumulate the number of ECDH keys
  • transform the KDF parameters field into a string (e.g. 4_1_SHA256_AES128 for a comprehensible form, or 5_1_SHA256_AES128_0x03 if there is a mysterious trailing 0x03 octet, or 4_2_0x0807 for an unknown version)
  • count the number of each string in the dataset.
  • sort the strings by most popular.

This would help to answer questions like those raised on openpgp-wg/rfc4880bis!160 (closed)

Edited Feb 23, 2023 by Daniel Kahn Gillmor
Assignee Loading
Time tracking Loading