Beispiel #1
0
 def TLSUBInt8Length5Array(self):  # noqa
     """
     Like
     :py:meth:`TLSPrefixedArrayWithLengthValidator.TLSUBInt8Length5Array`,
     but only accepts arrays of length 5.
     """
     return TLSPrefixedArray("data",
                             UBInt8("datum"),
                             length_validator=Equals5)
Beispiel #2
0
 def tls_array(self):
     """
     A :py:func:`tls._common._constructs.TLSPrefixedArray` of
     :py:func:`construct.macros.UBInt8` where the length prefix for the
     array size is specified with a :py:class`UBInt24` value.
     """
     return TLSPrefixedArray("digits",
                             UBInt8("digit"),
                             length_field_size=UBInt24)
Beispiel #3
0
 def TLSUBInt8Array(self):  # noqa
     """
     A :py:class:`tls._common._constructs.TLSPrefixedArray` specialized on
     :py:func:`construct.macros.UBInt8`
     """
     return TLSPrefixedArray("data", UBInt8("datum"))
Beispiel #4
0
 def tls_array(self):
     """
     A :py:func:`tls._common._constructs.TLSPrefixedArray` of
     :py:func:`construct.macros.UBInt8`.
     """
     return TLSPrefixedArray("digits", UBInt8("digit"))
Beispiel #5
0
    "session_id",
    PrefixedBytes("session_id"),
)

CompressionMethods = Struct(
    "compression_methods", SizeAtLeast(UBInt8("length"), min_size=1),
    Array(lambda ctx: ctx.length, UBInt8("compression_methods")))

HostName = PrefixedBytes("hostname", UBInt16("length"))

ServerName = Struct(
    "server_name", EnumClass(UBInt8("name_type"), enums.NameType),
    Switch("name", lambda ctx: ctx.name_type,
           {enums.NameType.HOST_NAME: HostName}))

ServerNameList = TLSPrefixedArray("server_name_list", ServerName)

ClientCertificateURL = Struct(
    "client_certificate_url",
    # The "extension_data" field of this extension SHALL be empty.
)

SignatureAndHashAlgorithm = Struct(
    "algorithms",
    EnumClass(UBInt8("hash"), enums.HashAlgorithm),
    EnumClass(UBInt8("signature"), enums.SignatureAlgorithm),
)

SupportedSignatureAlgorithms = TLSPrefixedArray(
    "supported_signature_algorithms",
    SignatureAndHashAlgorithm,
Beispiel #6
0
    "session_id",
    PrefixedBytes("session_id"),
)

CompressionMethods = Struct(
    "compression_methods", SizeAtLeast(UBInt8("length"), min_size=1),
    Array(lambda ctx: ctx.length, UBInt8("compression_methods")))

HostName = PrefixedBytes("hostname", UBInt16("length"))

ServerName = Struct(
    "server_name", EnumClass(UBInt8("name_type"), enums.NameType),
    Switch("name", lambda ctx: ctx.name_type,
           {enums.NameType.HOST_NAME: HostName}))

ServerNameList = TLSPrefixedArray("server_name_list", ServerName)

ClientCertificateURL = Struct(
    "client_certificate_url",
    # The "extension_data" field of this extension SHALL be empty.
)

SignatureAndHashAlgorithm = Struct(
    "algorithms",
    EnumClass(UBInt8("hash"), enums.HashAlgorithm),
    EnumClass(UBInt8("signature"), enums.SignatureAlgorithm),
)

SupportedSignatureAlgorithms = TLSPrefixedArray(
    "supported_signature_algorithms",
    SignatureAndHashAlgorithm,