class documentation

class twisted.conch.client.knownhosts.HashedEntry(_BaseEntry, FancyEqMixin): (source)

Implements interfaces: twisted.conch.interfaces.IKnownHostEntry

View In Hierarchy

A HashedEntry is a representation of an entry in a known_hosts file where the hostname has been hashed and salted.

Class Variable MAGIC the 'hash magic' string used to identify a hashed line in a known_hosts file as opposed to a plaintext one.
Class Variable compareAttributes Undocumented
Method __init__ Undocumented
Class Method fromString Load a hashed entry from a string representing a line in a known_hosts file.
Method matchesHost Implement IKnownHostEntry.matchesHost to compare the hash of the input to the stored hash.
Method toString Implement IKnownHostEntry.toString by base64-encoding the salt, host hash, and key.
Instance Variable _hostSalt the salt to combine with a hostname for hashing.
Instance Variable _hostHash the hashed representation of the hostname.

Inherited from _BaseEntry:

Instance Variable keyType The type of the key; either ssh-dss or ssh-rsa.
Instance Variable publicKey The server public key indicated by this line.
Instance Variable comment Trailing garbage after the key line.
Method matchesKey Check to see if this entry matches a given key object.

Inherited from FancyEqMixin:

Method __eq__ Undocumented
Method __ne__ Undocumented
_hostSalt = (source)
the salt to combine with a hostname for hashing.
_hostHash = (source)
the hashed representation of the hostname.
MAGIC = (source)
the 'hash magic' string used to identify a hashed line in a known_hosts file as opposed to a plaintext one.
(type: bytes)
compareAttributes = (source)

Undocumented

(type: tuple[str, ...])
def __init__(self, hostSalt, hostHash, keyType, publicKey, comment): (source)
@classmethod
def fromString(cls, string): (source)

Load a hashed entry from a string representing a line in a known_hosts file.

ParametersstringA complete single line from a known_hosts file, formatted as defined by OpenSSH. (type: bytes)
ReturnsThe newly created HashedEntry instance, initialized with the information from string.
RaisesDecodeErrorif the key, the hostname, or the is not valid encoded as valid base64
InvalidEntryif the entry does not have the right number of elements and is therefore invalid, or the host/hash portion contains more items than just the host and hash.
BadKeyErrorif the key, once decoded from base64, is not actually an SSH key.
def matchesHost(self, hostname): (source)

Implement IKnownHostEntry.matchesHost to compare the hash of the input to the stored hash.

ParametershostnameA hostname or IP address literal to check against this entry. (type: bytes)
ReturnsTrue if this entry is for the given hostname or IP address, False otherwise. (type: bool)
def toString(self): (source)

Implement IKnownHostEntry.toString by base64-encoding the salt, host hash, and key.

ReturnsThe string representation of this entry, with the hostname part hashed. (type: bytes)
API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.