Ñò
Ã#xPc @ s d Z d d k Z d d k Z d d k Z d d k l Z l Z d g Z e i d ƒ Z e i d ƒ Z
d e f d „ ƒ YZ d S( s
SSH utilities.
iÿÿÿÿN( t md5t sha1t SSHPublicKeysj ^[\t ]*(?P[^\x00\n\r]+?) [\t ]*(?P[^\x00\n\r]+?)(?:[\t ]+(?P[^\x00\n\r]*?)[\t ]*)?$s? (?P[-0-9A-Za-z]+)(?:="(?P(?:\\"|[^\x00\n\r"])*)")?c B s‰ e Z d Z d Z d d 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 RS( s
SSH public key object.
t _keyt _keytypet _commentt _optionss utf-8c C s* t | t ƒ o5 | i | _ | i | _ | i | _ | i | _ d St | t t f ƒ p t d t | ƒ i
ƒ ‚ n t | t ƒ o$ | d d j o | i | ƒ } n | i | ƒ p | i
| ƒ p
| i | ƒ } | p t d ƒ ‚ n | d j o
| | _ n | d j o
| | _ n d S( Ns' argument must be str or unicode, got %si t s not a valid SSH public key( t
isinstanceR R R R R t strt unicodet TypeErrort typet __name__t decodet
_parse_rawt
_parse_base64t _parse_openssht
ValueErrort None( t selft keyt commentt optionst encodingt valid( ( s1 /usr/lib/python2.6/site-packages/ipapython/ssh.pyt __init__+ s" !/
c C sÒ t | t ƒ p t Sy t i d | d ƒ \ } Wn t i j
o t SX| d j p | t | ƒ d j o t Sy | d | d !i d ƒ } Wn t j
o t SX| | _ | | _
h | _ d | _
t S( Ns >Ii i t ascii( R R t Falset structt unpackt errort lenR t UnicodeDecodeErrorR R R R R t True( R R t ktlent keytype( ( s1 /usr/lib/python2.6/site-packages/ipapython/ssh.pyR D s" $ c C sL t | t ƒ p t Sy t i | ƒ } Wn t j
o t SX| i | ƒ S( N( R R
R t base64t b64decodeR R ( R R ( ( s1 /usr/lib/python2.6/site-packages/ipapython/ssh.pyR \ s c C sm t i | ƒ } | p t S| i | i d ƒ ƒ p t S| i | i d ƒ j o t S| i d ƒ | _ t S( NR R$ R ( t OPENSSH_BASE_REGEXt matchR R t groupR R R" ( R R R( ( ( s1 /usr/lib/python2.6/site-packages/ipapython/ssh.pyt _parse_openssh_without_optionsg s c C sì | i d ƒ } h } x² t oª t i | ƒ } | p t S| i d ƒ i ƒ } | i d ƒ } | o | i d d ƒ } n | | | <| t | i d ƒ ƒ } | d | d } } | d j o Pq q W| i | ƒ p t S| | _
t S( Ns t namet values \"t "i i t ,( t lstripR" t OPENSSH_OPTIONS_REGEXR( R R) t lowert replaceR R* R ( R R R R( R+ R, t key0( ( s1 /usr/lib/python2.6/site-packages/ipapython/ssh.pyt _parse_openssh_with_optionsv s(
c C s; t | t ƒ p t S| i | ƒ o t S| i | ƒ Sd S( N( R R
R R* R" R4 ( R R ( ( s1 /usr/lib/python2.6/site-packages/ipapython/ssh.pyR “ s
c C s | i S( N( R ( R ( ( s1 /usr/lib/python2.6/site-packages/ipapython/ssh.pyR$ œ s c C s | i S( N( R ( R ( ( s1 /usr/lib/python2.6/site-packages/ipapython/ssh.pyR Ÿ s c C s
t | i ƒ S( N( t boolR ( R ( ( s1 /usr/lib/python2.6/site-packages/ipapython/ssh.pyt has_options¢ s c C så d | i t i | i ƒ f } | i o— g } xk t | i ƒ D]Z } | i | } | d j o | i | ƒ q? | i d d ƒ } | i d | | f ƒ q? Wd i | ƒ } d | | f } n | i
o d | | i
f } n | S( Nu %s %sR- s \"u %s="%s"u ,( R R% t b64encodeR R t sortedR t appendR2 t joinR ( R t outR R+ R, ( ( s1 /usr/lib/python2.6/site-packages/ipapython/ssh.pyt openssh¥ s
c C sf t | i ƒ i ƒ i ƒ } d i g } t d t | ƒ d ƒ D] } | | | | d !q> ~ ƒ } | S( Nu :i i ( R R t hexdigestt upperR: t rangeR ( R t fpt _[1]t j( ( s1 /usr/lib/python2.6/site-packages/ipapython/ssh.pyt fingerprint_hex_md5º s Gc C sa | i d j o
d } n | i d j o
d } n d St | i ƒ i ƒ i ƒ } d | | f S( Ns ssh-rsai s ssh-dssi u %d 1 %s( R R R R= R> ( R R$ R@ ( ( s1 /usr/lib/python2.6/site-packages/ipapython/ssh.pyt fingerprint_dns_sha1¿ s
( s _keys _keytypes _comments _optionsN( R
t
__module__t __doc__t __slots__R R R R R* R4 R R$ R R6 R<