Key Manager Module
- class mtf.network_port.tls.key_manager.KeyManager
A class to handle key management operations, including logging TLS key material and maintaining a dictionary of key material for debugging and verification purposes.
- Attributes:
keylog_file_path (str): The path to the file where key material will be logged. file_cleared (bool): A flag indicating whether the key log file has been cleared. key_material_dict (dict): A dictionary to store key material with specific labels.
- __init__(keylog_file_path)
- default_keylog_callback(connection, key_material)
Callback function to handle logging of TLS key material.
This function is called whenever TLS key material is generated or received. It writes the key material to a log file and updates a dictionary with the key material for each recognized label.
- Parameters:
connection (SSL.Connection) – The SSL/TLS connection object associated with the key material.
key_material (bytes) – The key material to log, which includes the label and associated key.
- Returns:
None
- log_key_material_dict()
Log the contents of the key material dictionary.
This function prints each label and the associated key material stored in the key_material_dict. It helps in debugging and verifying the key material collected during the TLS sessions.
- Returns:
None