sshmitm.utils module

class sshmitm.utils.SSHPubKey(key, comment=None)

Bases: object

Parameters:
  • key (PKey)

  • comment (str | None, default: None)

can_sign()
Return type:

bool

classmethod from_ssh_line(line)

Loads a public SSH key from a line in the format ‘<type> <base64> [comment]’

Parameters:

line (str)

Return type:

SSHPubKey

get_base64()
Return type:

str

get_bits()
Return type:

int

get_name()
Return type:

str

hash_md5()

Calculate md5 fingerprint.

For specification, see RFC4716, section 4.

Return type:

str

hash_sha256()

Calculate sha256 fingerprint.

Return type:

str

hash_sha512()

Calculates sha512 fingerprint.

Return type:

str

sshmitm.utils.format_hex(data, hexwidth=19)

Format the data in hexadecimal format.

Parameters:
  • data (bytes) – Data to be formatted

  • hexwidth (int, default: 19) – Width of hexadecimal data (default 19)

Return type:

str

Returns:

Formatted hexadecimal data