crypto: golang.org/x/crypto/ssh/knownhosts Index | Files

package knownhosts

import "golang.org/x/crypto/ssh/knownhosts"

Package knownhosts implements a parser for the OpenSSH known_hosts host key database.

Index

Package Files

knownhosts.go

func HashHostname Uses

func HashHostname(hostname string) string

HashHostname hashes the given hostname. The hostname is not normalized before hashing.

func Line Uses

func Line(addresses []string, key ssh.PublicKey) string

Line returns a line to add append to the known_hosts files.

func New Uses

func New(files ...string) (ssh.HostKeyCallback, error)

New creates a host key callback from the given OpenSSH host key files. The returned callback is for use in ssh.ClientConfig.HostKeyCallback. Hashed hostnames are not supported.

func Normalize Uses

func Normalize(address string) string

Normalize normalizes an address into the form used in known_hosts

type KeyError Uses

type KeyError struct {
    // Want holds the accepted host keys. For each key algorithm,
    // there can be one hostkey.  If Want is empty, the host is
    // unknown. If Want is non-empty, there was a mismatch, which
    // can signify a MITM attack.
    Want []KnownKey
}

KeyError is returned if we did not find the key in the host key database, or there was a mismatch. Typically, in batch applications, this should be interpreted as failure. Interactive applications can offer an interactive prompt to the user.

func (*KeyError) Error Uses

func (u *KeyError) Error() string

type KnownKey Uses

type KnownKey struct {
    Key      ssh.PublicKey
    Filename string
    Line     int
}

KnownKey represents a key declared in a known_hosts file.

func (*KnownKey) String Uses

func (k *KnownKey) String() string

type RevokedError Uses

type RevokedError struct {
    Revoked KnownKey
}

RevokedError is returned if we found a key that was revoked.

func (*RevokedError) Error Uses

func (r *RevokedError) Error() string

Package knownhosts imports 13 packages (graph) and is imported by 11 packages. Updated 2017-08-18. Refresh now. Tools for package owners.