#[non_exhaustive]pub struct PublicKey {
pub bytes: Vec<u8>,
pub printed: Option<String>,
pub encoding: Option<String>,
pub content_type: Option<String>,
pub shape: PublicKeyShape,
}Expand description
The public key a station claims signed a record.
§Two shapes, both conformant in practice
The OCA application note §3.2.2 specifies Base64 over a colon-separated envelope —
oca:<encoding>:<content-type>:<printed public key> — where the last part is the key as
printed on the certified meter, so that a customer can compare it against the label on
the cabinet. For base16 it adds that non-hexadecimal characters and a leading 0x
“SHALL be ignored”, because a printed key has spaces in it.
The same document’s example message (§5.2) then sends Base64 over plain uppercase
hexadecimal with no envelope at all. A reader that implements only the specification
rejects the whitepaper’s own example; one that implements only the example rejects every
conformant station. Both are in the field, so both are read here, and
shape says which arrived.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.bytes: Vec<u8>The key bytes.
printed: Option<String>The key as it was written — what to show a customer comparing it with the meter’s
label. None for PublicKeyShape::Opaque, where there was no text.
encoding: Option<String>The envelope’s encoding token (base16, base32, base64), when there was an
envelope.
content_type: Option<String>The envelope’s content type — the key’s own format, such as a curve name — when there was an envelope.
shape: PublicKeyShapeWhich shape the field arrived in.