예제 #1
0
# We will have a superset of formats in TUF
from tuf.formats import *
import tuf.schema as SCHEMA

# Constitutes a nonce used by e.g. ECUs to help defend their validation of
# responses from the timeserver against replay attacks.
NONCE_LOWER_BOUND = 0
NONCE_UPPER_BOUND = 2147483647
NONCE_SCHEMA = SCHEMA.Integer(lo=NONCE_LOWER_BOUND, hi=NONCE_UPPER_BOUND)

# A list of nonces to be bundled in the primary's request to the timeserver
# for a signed and nonce-incorporating time datum.
NONCE_LIST_SCHEMA = SCHEMA.ListOf(NONCE_SCHEMA)

# Uniquely identifies a vehicle.
VIN_SCHEMA = SCHEMA.AnyString()

# Information characterizing and identifying an ECU.
# ECU_SCHEMA = SCHEMA.Object(
#     ecu_id = SCHEMA.AnyString(),
#     ecu_type = SCHEMA.AnyString(),
#     vin = VIN_SCHEMA)
ECU_SERIAL_SCHEMA = SCHEMA.AnyString(
)  # Instead, for now, we'll go with an ecu serial number.

# Information specifying the target(s) installed on a given ECU.
# This object corresponds to not "ECUVersionManifest" in the Uptane
# Implementation Specification, but the signed contents of that object.
ECU_VERSION_MANIFEST_SCHEMA = SCHEMA.Object(
    ecu_serial=ECU_SERIAL_SCHEMA,
    installed_image=TARGETFILE_SCHEMA,
예제 #2
0
파일: formats.py 프로젝트: smith325/tuf
import tuf
import tuf.schema as SCHEMA

# Note that in the schema definitions below, the 'SCHEMA.Object' types allow
# additional keys which are not defined. Thus, any additions to them will be
# easily backwards compatible with clients that are already deployed.

# A date in 'YYYY-MM-DD HH:MM:SS UTC' format.
TIME_SCHEMA = SCHEMA.RegularExpression(
    r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC')

# A hexadecimal value in '23432df87ab..' format.
HASH_SCHEMA = SCHEMA.RegularExpression(r'[a-fA-F0-9]+')

# A dict in {'sha256': '23432df87ab..', 'sha512': '34324abc34df..', ...} format.
HASHDICT_SCHEMA = SCHEMA.DictOf(key_schema=SCHEMA.AnyString(),
                                value_schema=HASH_SCHEMA)

# A hexadecimal value in '23432df87ab..' format.
HEX_SCHEMA = SCHEMA.RegularExpression(r'[a-fA-F0-9]+')

# A key identifier (e.g., a hexadecimal value identifying an RSA key).
KEYID_SCHEMA = HASH_SCHEMA
KEYIDS_SCHEMA = SCHEMA.ListOf(KEYID_SCHEMA)

# The method used for a generated signature (e.g., 'evp').
SIG_METHOD_SCHEMA = SCHEMA.AnyString()

# A relative file path (e.g., 'metadata/root/').
RELPATH_SCHEMA = SCHEMA.AnyString()
RELPATHS_SCHEMA = SCHEMA.ListOf(RELPATH_SCHEMA)
예제 #3
0
파일: formats.py 프로젝트: vikstrous/tuf
# supported.)  Example: '2015-10-21T13:20:00Z'.  Note:  This is a simple format
# check, and an ISO8601 string should be fully verified when it is parsed.
ISO8601_DATETIME_SCHEMA = SCHEMA.RegularExpression(
    r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z')

# A Unix/POSIX time format.  An integer representing the number of seconds
# since the epoch (January 1, 1970.)  Metadata uses this format for the
# 'expires' field.  Set 'hi' to the upper timestamp limit (year 2038), the max
# value of an int.
UNIX_TIMESTAMP_SCHEMA = SCHEMA.Integer(lo=0, hi=2147483647)

# A hexadecimal value in '23432df87ab..' format.
HASH_SCHEMA = SCHEMA.RegularExpression(r'[a-fA-F0-9]+')

# A dict in {'sha256': '23432df87ab..', 'sha512': '34324abc34df..', ...} format.
HASHDICT_SCHEMA = SCHEMA.DictOf(key_schema=SCHEMA.AnyString(),
                                value_schema=HASH_SCHEMA)

# A hexadecimal value in '23432df87ab..' format.
HEX_SCHEMA = SCHEMA.RegularExpression(r'[a-fA-F0-9]+')

# A key identifier (e.g., a hexadecimal value identifying an RSA key).
KEYID_SCHEMA = HASH_SCHEMA

# A list of KEYID_SCHEMA.
KEYIDS_SCHEMA = SCHEMA.ListOf(KEYID_SCHEMA)

# The method used for a generated signature (e.g., 'RSASSA-PSS').
SIG_METHOD_SCHEMA = SCHEMA.AnyString()

# A relative file path (e.g., 'metadata/root/').
예제 #4
0
# supported.)  Example: '2015-10-21T13:20:00Z'.  Note:  This is a simple format
# check, and an ISO8601 string should be fully verified when it is parsed.
ISO8601_DATETIME_SCHEMA = SCHEMA.RegularExpression(
    r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z')

# A Unix/POSIX time format.  An integer representing the number of seconds
# since the epoch (January 1, 1970.)  Metadata uses this format for the
# 'expires' field.  Set 'hi' to the upper timestamp limit (year 2038), the max
# value of an int.
UNIX_TIMESTAMP_SCHEMA = SCHEMA.Integer(lo=0, hi=2147483647)

# A hexadecimal value in '23432df87ab..' format.
HASH_SCHEMA = SCHEMA.RegularExpression(r'[a-fA-F0-9]+')

# A dict in {'sha256': '23432df87ab..', 'sha512': '34324abc34df..', ...} format.
HASHDICT_SCHEMA = SCHEMA.DictOf(key_schema=SCHEMA.AnyString(),
                                value_schema=HASH_SCHEMA)

# A hexadecimal value in '23432df87ab..' format.
HEX_SCHEMA = SCHEMA.RegularExpression(r'[a-fA-F0-9]+')

# A key identifier (e.g., a hexadecimal value identifying an RSA key).
KEYID_SCHEMA = HASH_SCHEMA

# A list of KEYID_SCHEMA.
KEYIDS_SCHEMA = SCHEMA.ListOf(KEYID_SCHEMA)

# The method used for a generated signature (e.g., 'RSASSA-PSS').
SIG_METHOD_SCHEMA = SCHEMA.AnyString()

# A relative file path (e.g., 'metadata/root/').
예제 #5
0
# We will have a superset of formats in TUF
from tuf.formats import *
import tuf.schema as SCHEMA

# Constitutes a nonce used by e.g. ECUs to help defend their validation of
# responses from the timeserver against replay attacks.
NONCE_LOWER_BOUND = 0
NONCE_UPPER_BOUND = 2147483647
NONCE_SCHEMA = SCHEMA.Integer(lo=NONCE_LOWER_BOUND, hi=NONCE_UPPER_BOUND)

# A list of nonces to be bundled in the primary's request to the timeserver
# for a signed and nonce-incorporating time datum.
NONCE_LIST_SCHEMA = SCHEMA.ListOf(NONCE_SCHEMA)

# Uniquely identifies a vehicle.
VIN_SCHEMA = SCHEMA.AnyString()

# Information characterizing and identifying an ECU.
# ECU_SCHEMA = SCHEMA.Object(
#     ecu_id = SCHEMA.AnyString(),
#     ecu_type = SCHEMA.AnyString(),
#     vin = VIN_SCHEMA)
ECU_SERIAL_SCHEMA = SCHEMA.AnyString() # Instead, for now, we'll go with an ecu serial number.


# Information specifying the target(s) installed on a given ECU.
# This object corresponds to not "ECUVersionManifest" in the Uptane
# Implementation Specification, but the signed contents of that object.
ECU_VERSION_MANIFEST_SCHEMA = SCHEMA.Object(
    ecu_serial = ECU_SERIAL_SCHEMA,
    #current_bootloader_images = SCHEMA.ListOf(TARGETFILE_SCHEMA), # multiple targets per ECU possible