Serialization¶
JSON serialization¶
TUF role metadata JSON serialization and deserialization.
This module provides concrete implementations to serialize and deserialize TUF role metadata to and from the JSON wireline format for transportation, and to serialize the ‘signed’ part of TUF role metadata to the OLPC Canonical JSON format for signature generation and verification.
- class tuf.api.serialization.json.CanonicalJSONSerializer¶
Bases:
tuf.api.serialization.SignedSerializer
Provides Signed to OLPC Canonical JSON serialize method.
- serialize(signed_obj: tuf.api.metadata.Signed) bytes ¶
Serialize Signed object into utf-8 encoded OLPC Canonical JSON bytes.
- class tuf.api.serialization.json.JSONDeserializer¶
Bases:
tuf.api.serialization.MetadataDeserializer
Provides JSON to Metadata deserialize method.
- deserialize(raw_data: bytes) tuf.api.metadata.Metadata ¶
Deserialize utf-8 encoded JSON bytes into Metadata object.
- class tuf.api.serialization.json.JSONSerializer(compact: bool = False)¶
Bases:
tuf.api.serialization.MetadataSerializer
Provides Metadata to JSON serialize method.
- compact¶
A boolean indicating if the JSON bytes generated in ‘serialize’ should be compact by excluding whitespace.
- serialize(metadata_obj: tuf.api.metadata.Metadata) bytes ¶
Serialize Metadata object into utf-8 encoded JSON bytes.