trestle.core.canonicalization
trestle.core.canonicalization ¤
Canonical JSON helpers for reproducible OSCAL artifact digests.
Classes¤
Functions:¤
canonicalize_json_object(json_obj) ¤
Return RFC 8785 canonical UTF-8 bytes for a parsed JSON-compatible object.
Source code in trestle/core/canonicalization.py
54 55 56 57 58 59 | |
canonicalize_json_text(json_text) ¤
Parse JSON text and return its parsed object and canonical bytes.
Source code in trestle/core/canonicalization.py
42 43 44 45 46 47 48 49 50 51 | |
digest_algorithm_name(algorithm) ¤
Return the hashlib and in-toto name for a supported OSCAL digest algorithm.
Source code in trestle/core/canonicalization.py
62 63 64 65 66 67 68 69 | |
digest_hex(data, algorithm) ¤
Return a hexadecimal digest using the selected OSCAL algorithm.
Source code in trestle/core/canonicalization.py
72 73 74 | |
load_canonical_json_file(path) ¤
Load a JSON document and return its parsed object and canonical bytes.
Source code in trestle/core/canonicalization.py
34 35 36 37 38 39 | |
parse_digest_algorithm(name) ¤
Resolve an in-toto digest name to a supported OSCAL algorithm.
Source code in trestle/core/canonicalization.py
77 78 79 80 81 82 83 84 | |
sha256_digest_hex(data) ¤
Return a SHA-256 digest for compatibility with existing callers.
Source code in trestle/core/canonicalization.py
87 88 89 90 91 | |
handler: python