| 1 |
# Copyright New York University and the in-toto contributors |
| 2 |
# SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
""" |
| 5 |
<Program Name> |
| 6 |
formats.py |
| 7 |
|
| 8 |
<Author> |
| 9 |
Lukas Puehringer <[email protected]> |
| 10 |
Santiago Torres-Arias <[email protected]> |
| 11 |
|
| 12 |
<Started> |
| 13 |
November 28, 2017. |
| 14 |
|
| 15 |
<Copyright> |
| 16 |
See LICENSE for licensing information. |
| 17 |
|
| 18 |
<Purpose> |
| 19 |
Format schemas for in-toto metadata, based on securesystemslib.schema. |
| 20 |
|
| 21 |
The schemas can be verified using the following methods inherited from |
| 22 |
securesystemslib.schema: |
| 23 |
|
| 24 |
in_toto.formats.<SCHEMA>.check_match(<object to verify>) |
| 25 |
in_toto.formats.<SCHEMA>.matches(<object to verify>) |
| 26 |
|
| 27 |
`check_match` raises a securesystemslib.exceptions.FormatError and `matches` |
| 28 |
returns False if the verified object does not match the schema (True |
| 29 |
otherwise). |
| 30 |
|
| 31 |
""" |
| 32 |
import securesystemslib.schema as ssl_schema |
| 33 |
|
| 34 |
PARAMETER_DICTIONARY_KEY = ssl_schema.RegularExpression(r"[a-zA-Z0-9_-]+") |
| 35 |
PARAMETER_DICTIONARY_SCHEMA = ssl_schema.DictOf( |
| 36 |
key_schema=PARAMETER_DICTIONARY_KEY, value_schema=ssl_schema.AnyString() |
| 37 |
) |