tls.test package¶
Submodules¶
tls.test.test_alert module¶
tls.test.test_ciphersuites module¶
tls.test.test_hello_messages module¶
-
class
tls.test.test_hello_messages.TestClientHello¶ Bases:
objectTests for the parsing of ClientHello messages.
-
test_as_bytes_no_extensions()¶ ClientHello.as_bytes()returns the bytes it was created with
-
test_as_bytes_with_extensions()¶ ClientHello.as_bytes()returns the bytes it was created with
-
test_resumption_no_extensions()¶ parse_client_hello()returns an instance ofClientHello.
-
-
class
tls.test.test_hello_messages.TestServerHello¶ Bases:
objectTests for the parsing of ServerHello messages.
-
test_as_bytes_no_extensions()¶ ServerHello.as_bytes()returns the bytes it was created with
-
test_as_bytes_with_extensions()¶ ServerHello.as_bytes()returns the bytes it was created with
-
test_parse_server_hello()¶ parse_server_hello()returns an instance ofServerHello.
-
test_parse_server_hello_extensions()¶ parse_server_hello()returns an instance ofServerHello.
-
tls.test.test_message module¶
-
class
tls.test.test_message.TestCertificateParsing¶ Bases:
objectTests for parsing of Certificate messages.
-
class
tls.test.test_message.TestCertificateRequestParsing¶ Bases:
objectTests for parsing of CertificateRequest messages.
-
class
tls.test.test_message.TestHandshakeStructParsing¶ Bases:
objectTests for parsing of Handshake structs.
tls.test.test_record module¶
-
class
tls.test.test_record.TestTLSCiphertextParser¶ Bases:
objectTests for parsing of TLSCiphertext records.
-
test_parse_tls_ciphertext_handshake()¶ TLSCiphertext, which has attributes representing all the fields in the TLSCiphertext struct.
-
-
class
tls.test.test_record.TestTLSCompressedParsing¶ Bases:
objectTests for parsing of TLSCompressed records.
-
test_incomplete_packet()¶ Reject an incomplete packet
-
test_not_enough_data_to_fragment()¶ Detect insufficient data to fragment.
-
test_parse_tls_compressed_handshake()¶ TLSCompressed, which has attributes representing all the fields in the TLSCompressed struct.
-
test_parse_tls_compressed_wrong_type()¶ Raise an error when the type is not one of those defined in ContentType
-
-
class
tls.test.test_record.TestTLSPlaintextParsing¶ Bases:
objectTests for parsing of TLSPlaintext records.
-
test_as_bytes()¶ Construct a TLSPlaintext object as bytes.
-
test_incomplete_packet()¶ Reject an incomplete packet
-
test_not_enough_data_to_fragment()¶ Detect insufficient data to fragment.
-
test_parse_tls_plaintext_handshake()¶ parse_tls_plaintext()returns an instance ofTLSPlaintext, which has attributes representing all the fields in the TLSPlaintext struct.
-
test_parse_tls_plaintext_wrong_type()¶ Raise an error when the type is not one of those defined in ContentType
-
tls.test.test_utils module¶
-
class
tls.test.test_utils.IntegerEnum¶ Bases:
enum.EnumAn enum of
intinstances. Used as a test fixture.
-
class
tls.test.test_utils.TestBytesAdapter¶ Bases:
objectTests for
tls.utils.BytesAdapter.-
bytes_adapted()¶ A
tls.utils.BytesAdapterthat adapts a trivialconstruct.Construct().
-
test_decode_passes_value_through(bytes_adapted, value)¶
-
-
class
tls.test.test_utils.TestEnumClass¶ Bases:
objectTests for
tls.utils.EnumClass().-
UBInt8Enum()¶ A
tls.utils.EnumClass()that adaptsIntegerEnum‘s members toUBInt8().
-
test_build(UBInt8Enum)¶ tls.utils.EnumClass()encodes members of its enum according to its construct.
-
test_build_enum_has_wrong_type(UBInt8Enum)¶ tls.utils.EnumClass()raisesconstruct.adapters.MappingErrorwhen encoding something that isn’t a member of its enum.
-
test_parse(UBInt8Enum)¶ tls.utils.EnumClass()decodes a binary sequence as members of its enum via its construct.
-
-
class
tls.test.test_utils.TestEnumSwitch¶ Bases:
objectTests for
tls.utils.EnumSwitch().-
UBInt8EnumMappedStruct()¶ A
construct.core.Structcontaining antls.utils.EnumSwitch()that switches onIntegerEnum. The struct’svaluefield varies depending on the value of itstypeand the corresponding enum member specified in thevalue_choicesdictionary passed to thetls.utils.EnumSwitch().
-
test_build(UBInt8EnumMappedStruct, type_, value, encoded)¶ A struct that contains
tls.utils.EnumSwitch()encodes itsvalue_fieldaccording to the enum member specified in itstype_field.
-
test_parse(UBInt8EnumMappedStruct, type_, value, encoded)¶ A struct that contains
tls.utils.EnumSwitch()decodes its value field according to the enum member specified by itstype_field.
-
test_round_trip(UBInt8EnumMappedStruct, type_, value, encoded)¶ A struct that contains
tls.utils.EnumSwitch()decodes a binary sequence encoded by a struct with that sametls.utils.EnumSwitch()and vice versa.
-
-
class
tls.test.test_utils.TestPrefixedBytesWithDefaultLength¶ Bases:
objectTests for
tls.utils.PrefixedBytes()with the defaultconstruct.macros.UBInt8()length_fieldconstruct.-
prefixed_bytes()¶ A trivial
tls.utils.PrefixedBytes()construct with the defaultconstruct.macros.UBInt8()length field.
-
test_build(prefixed_bytes, bytestring, encoded)¶ tls.utils.PrefixedBytes()encodesbytesas a length-prefixed byte sequence.
-
test_parse(prefixed_bytes, bytestring, encoded)¶ tls.utils.PrefixedBytes()decodes a length-prefixed byte sequence asbytes.
-
test_round_trip(prefixed_bytes, bytestring, encoded)¶ tls.utils.PrefixedBytes()decodes a length-prefixed binary sequence encoded bytls.utils.PrefixedBytes()and vice versa.
-
-
class
tls.test.test_utils.TestPrefixedBytesWithOverriddenLength¶ Bases:
objectTests for
tls.utils.PrefixedBytes()with a user-suppliedlength_fieldconstruct.-
test_build(bytestring, encoded, length_field)¶ tls.utils.PrefixedBytes()uses the suppliedlength_fieldto encodebytesas a length-prefix binary sequence.
-
test_parse(bytestring, encoded, length_field)¶ tls.utils.PrefixedBytes()decodes a length-prefixed binary sequence intobytesaccording to the suppliedlength_field.
-
test_round_trip(bytestring, encoded, length_field)¶ tls.utils.PrefixedBytes()decodes a length-prefixed binary sequence encoded bytls.utils.PrefixedBytes()when the two share alength_fieldand vice versa.
-
-
class
tls.test.test_utils.TestTLSPrefixedArray¶ Bases:
objectTests for
tls.utils.TLSPrefixedArray().-
test_build(tls_array, ints, uint8_encoded)¶ A
tls.utils.TLSPrefixedArray()specialized on a givenconstruct.Construct()encodes a sequence of objects as a 16-bit length followed by each object as encoded by that construct.
-
test_parse(tls_array, ints, uint8_encoded)¶ A
tls.utils.TLSPrefixedArray()specialized on a givenconstruct.Construct()decodes a binary sequence, prefixed by its 16-bit length, as alistof objects decoded by that construct.
-
test_round_trip(tls_array, ints, uint8_encoded)¶ A
tls.utils.TLSPrefixedArray()decodes a length-prefixed binary sequence encoded by atls.utils.TLSPrefixedArray()specialized on the same construct and vice versa.
-
tls_array()¶ A
tls.utils.TLSPrefixedArray()ofconstruct.macros.UBInt8().
-