Current File : //lib/python2.7/site-packages/paramiko/hostkeys.pyc |
�
=OXc @ s+ d d l Z d d l Z d d l m Z d d l m Z d d l m Z m Z m Z m
Z
y d d l m Z Wn! e
k
r� d d l m Z n Xd d l m Z d d l m Z d d l m Z m Z d d
l m Z d d l m Z d e f d
� � YZ d e f d � � YZ d d d � � YZ d S( i����N( t sha1( t HMAC( t bt ut encodebytest decodebytes( t MutableMapping( t DictMixin( t DSSKey( t RSAKey( t
get_loggert constant_time_bytes_eq( t ECDSAKey( t SSHExceptiont HostKeysc B s� e Z d Z d d � Z d � Z d � Z d � Z d � Z d � Z d � Z
d � Z d � Z d
� Z
d � Z d � Z d
� Z d � Z e d d � � Z RS( sZ
Representation of an OpenSSH-style "known hosts" file. Host keys can be
read from one or more files, and then individual hosts can be looked up to
verify server keys during SSH negotiation.
A `.HostKeys` object can be treated like a dict; any dict lookup is
equivalent to calling `lookup`.
.. versionadded:: 1.5.3
c C s) g | _ | d k r% | j | � n d S( s�
Create a new HostKeys object, optionally loading keys from an OpenSSH
style host-key file.
:param str filename: filename to load host keys from, or ``None``
N( t _entriest Nonet load( t selft filename( ( s5 /usr/lib/python2.7/site-packages/paramiko/hostkeys.pyt __init__5 s c C se xB | j D]7 } | | j k r
| j j � | k r
| | _ d Sq
W| j j t | g | � � d S( s.
Add a host key entry to the table. Any existing entry for a
``(hostname, keytype)`` pair will be replaced.
:param str hostname: the hostname (or IP) to add
:param str keytype: key type (``"ssh-rsa"`` or ``"ssh-dss"``)
:param .PKey key: the key to add
N( R t hostnamest keyt get_namet appendt HostKeyEntry( R t hostnamet keytypeR t e( ( s5 /usr/lib/python2.7/site-packages/paramiko/hostkeys.pyt addA s
$ c C s t | d � �� } x� t | d � D]� \ } } | j � } t | � d k s"