v_c@sbddlZddlZddlZddlZddlZyddlZWn<ek rddlZddlZdfdYZnXe Z dZ dZ dZ dZdZdZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZ ide6de6de6de6de6de6de6d e6d!e6d"e6d#e6d$e6d%e6d&e6d'e6d(e6d)e 6Z!d Z"d*Z#dZ$d Z%d Z&dZ'd Z(d Z)d+Z*dZ+dZ,dZ-d,Z.d-Z/i d.e'6d/e(6d0e)6d1e*6d2e+6d3e,6d4e-6d5e.6d6e/6Z0d*Z1dZ2d Z3d Z4d Z5d Z6d Z7dZ8dZ9dZ:dZ;i d7e16d8e26d9e36d:e46d;e56d<e66d=e76d>e86d?e96d@e:6dAe;6Z<d*Z=dZ>d Z?d Z@idBe=6dCe>6dDe?6dEe@6ZAdZBd ZCd ZDd ZEd ZFd ZGdZHdZIdZJdZKdZLi dFeB6dGeC6dHeD6dIeE6dJeF6dKeG6dLeH6dMeI6dNeJ6dOeK6dPeL6ZMd*ZNdZOd ZPd+ZQdZRdZSdZTdQZUdRZVdSZWdTZXdUZYdVZZi dWeN6dXeO6dYeP6dZeQ6d[eR6d\eS6d]eT6d^eU6d_eV6d`eW6daeX6dbeY6dceZ6Z[d Z\d Z]d Z^d Z_d Z`dZadZbdZcdZddZed+Zfd,Zgd-ZhddZideZjdQZkdfZldgZmdhZndiZodjZpdkZqdRZrdSZsidle\6dme]6dne^6doe_6dpe`6dqea6dreb6dsec6dted6duee6dvef6dweg6dxeh6dyei6dzej6d{ek6d|el6d}em6d~en6deo6dep6deq6der6des6Ztd*ZudZvd Zwd ZxdSZyideu6dev6dew6dex6dey6ZzdZ{d Z|d Z}dZ~d+ZdZdZdVZdZide6ZdZdZdZdZdZdZdZdZdZdZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdZdZdZedZdZedkr^ddlZx,eeejdjD] ZeGHqLWndS(iNthashlibcBseZedZRS(cCs9|dkrtjS|dkr,tjStddS(Ntmd5tsha1sBad checksum type(Rtnewtshat ValueError(talgo((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR#s     (t__name__t __module__t staticmethodR(((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR!siii<i?iiiiiiiii i i i i iiiis#public-key encrypted session packetssignature packets&symmetric-key encrypted session packetsone-pass signature packetssecret-key certificate packetspublic-key certificate packetssecret-key subkey packetscompressed data packets#symmetric-key encrypted data packets marker packetsliteral data packets trust packetsuser id packetspublic subkey packetsuser attribute packets$symmetric encrypted integrity packets"modification detection code packetiiiisRSA (Encrypt or Sign)sRSA Encrypt-Onlys RSA Sign-OnlysElgamal Encrypt-Onlys DSA (Digital Signature Standard)sElliptic CurvetECDSAsElgamal (Encrypt or Sign)sDiffie-HellmansPlaintext or unencrypted datatIDEAs Triple-DEStCAST5tBlowfishs SAFER-SK128sDES/SKs AES 128-bits AES 192-bits AES 256-bitsTwofish 256-bitt UncompressedtZIPtZLIBtBZip2tMD5tSHA1t RIPEMD160sdouble-width SHAtMD2tTIGER192s HAVAL-5-160tSHA256tSHA384tSHA512tSHA224iii i(i0i@s document signature, binary images"document signature, canonical textssignature over just subpacketss;public key packet and user ID packet, generic certifications-public key packet and user ID packet, personas:public key packet and user ID packet, casual certifications<public key packet and user ID packet, positive certificationssubkey bindings key signatureskey revocationssubkey revocationscertificate revocationt timestampiiiiiiiissignature creation timessignature expiration timesexportable certificationstrust signaturesregular expressiont revocableskey expiration times&placeholder for backward compatibilityspreferred symmetric algorithmssrevocation keys issuer key IDs notation dataspreferred hash algorithmss preferred compression algorithmsskey server preferencesspreferred key serversprimary user ids policy URIs key flagsssigner's user idsreason for revocationtfeaturesssignature targetsembedded signaturesNo reason specifiedsKey is supercededsKey has been compromisedsKey is no longer useds&user id information is no longer validsModification DetectioncCsld}xY|dkratjd|||d!d}|dt|}|d}|d}q W||fS(sget_whole_number(msg, idx, numlen) extracts a "whole number" field of length numlen from msg at index idx returns (, new_idx) where the whole number is a long integer and new_idx is the index of the next element in the messagelitBil(tstructtunpacktlong(tmsgtidxtnumlentntb((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytget_whole_number:s! cCs(t|||\}}t||fS(siget_whole_int(msg, idx, numlen) same as get_whole_number but returns the number as an int for convenience(R'tint(R"R#R$R%((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyt get_whole_intGscCsPg}x:|dkrB|jdtjd|d@|dL}q Wdj|S(sKpack_long(l) returns big-endian representation of unsigned long integeriRiit(tinsertRtpacktjoin(tltarr((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyt pack_longMs  cCst|}t|dd}t|dkrlt|d}x-|dkrh|d7}|dL}qEWnd}tjd||S(s_pack_mpi(l) returns the PGP Multi-Precision Integer representation of unsigned long integeriiis>H(R0tlentordRR,(R.tstbitsR%((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytpack_mpiVs  cCs|t||d\}}|dkr.||fS|dkrlt||d\}}|dd>|d|fSt||dS(sfget_sig_subpak_len(msg, idx) extracts a signature subpacket length field returns (subpak_len, new_idx)iiiii(R)(R"R#tplentplen2((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytget_sig_subpak_lenfs   cCs7t||d\}}|ft|||ddS(sget_mpi(msg, idx) extracts a multi-precision integer field from the message msg at index idx returns (n, , new_idx) where the mpi is a long integer and new_idx is the index of the next element in the message and n is the number of bits of precision in iii(R)R'(R"R#tln((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyt get_n_mpirscCs!t||}|d|dfS(sget_mpi(msg, idx) extracts a multi-precision integer field from the message msg at index idx returns (, new_idx) where the mpi is a long integer and new_idx is the index of the next element in the messageii(R:(R"R#R.((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytget_mpi{scCsdjtdt|S(NR*cSstt|djdS(Ni(thexR2tzfill(tx((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyts(R-tmaptlist(R3((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyt str_to_hexscCsf|dkrdS|d}|d}|d}|d}|d}|d}|}d||||fS(Nitneveri<is%d days %02d:%02d:%02d((R3tsecstminsthrstdays((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytduration_to_strs       cCsg}t|tjkrBt|tjkrBt|f}nxI|D]A}||kro|j||qI|jdt|dqIWdj|S(Nsunknown(t)s, (ttypettypestListTypet TupleTypeRAtappendtstrR-(tmtvalstslistti((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyt map_to_strs*  t pgp_packetcBseZdZdZRS(cCs d|_dS(N(tNonetpkt_typ(tself((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyt__init__scCstt|jS(N(RTtctb_pkt_to_strRW(RX((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyt__str__s(RRRYR[(((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyRUs t public_keycBs>eZdZdZdZdZdZdZRS(cCs5tj|d|_d|_d|_d|_dS(Ni(RURYRVtversiontpk_algotkey_sizet fingerprint_(RX((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyRYs     cCs|jr|jS|jdkrltjd}|jt|j|jt|j|j|_n|jdkrtjd}|jd|j }|jt j dt ||j||j|_nt d|j|jS(NiRiRss>Hsunknown public key version %d(R`R]RRtupdateR0t pk_rsa_modt pk_rsa_exptdigestt serializeRR,R1t RuntimeError(RXthtbuf((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyt fingerprints     cCsA|jdkr t|jd@S|jdkr=|jdSdS(Nilii(R]R0RbRi(RX((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytkey_idscCsg}|jdkrx|jtjd|jt|j|j|j|jt|j |jt|j nm|jdkr|jtjd|jt|j|j|jt ks|jt kr|jt|j |jt|j q|jt krl|jt|j|jt|j|jt|j|jt|jq|jtks|jtkr|jt|j|jt|j|jt|jqtd|jndj|S(Nis>BIHBis>BIBsunknown public key algorithm %dR*(R]RNRR,R(RtvalidityR^R5RbRctALGO_PK_RSA_ENC_OR_SIGNtALGO_PK_RSA_SIGN_ONLYt ALGO_PK_DSAtpk_dsa_prime_ptpk_dsa_grp_ord_qtpk_dsa_grp_gen_gtpk_dsa_pub_keytALGO_PK_ELGAMAL_ENC_OR_SIGNtALGO_PK_ELGAMAL_ENC_ONLYtpk_elgamal_prime_ptpk_elgamal_grp_gen_gtpk_elgamal_pub_keyRfR-(RXtchunks((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyRes*4.cCsb|}t||d\|_}|jdkrj|jdkrj|jdkrjtd|j|fn|jdkrd|_nt||d\|_}t|j|_|jdkrt||d\|_}nt||d\|_}|jtks|jt krQt ||\|_ |_ }t ||\|_}n |jtkrt ||\}|_}t ||\|_}t ||\|_}t ||\}|_}|||_ n|jtks|jtkrEt ||\|_ |_}t ||\|_}t ||\|_}ntd|j|fdS(Niiiis*unknown public key packet version %d at %ds%unknown public key algorithm %d at %d(R)R]RfR'RtfloatRkR^RlRmR:R_RbR;RcRnRoRpRqRrRsRtRuRvRw(RXR"R#tpkt_lentidx_savetl1tl2((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyt deserializes2- cCs3tj}|jtj|d|jdt|jd|jdtj|j d|jdkr|jdtj|j |j ddddn|jdt |j d|j t ks|j tkr$|jd t|jd|jd t|jdn|j tkr|jd t|jd|jd t|jd|jd t|jd|jdt|jdn{|j tks|j tkr)|jdt|jd|jdt|jd|jdt|jdn|jS(Ns s version: s timestamp: is validity: ii<s pubkey algo: s pk_rsa_mod: s pk_rsa_exp: spk_dsa_prime_p: spk_dsa_grp_ord_q: spk_dsa_grp_gen_g: spk_dsa_pub_key: spk_elgamal_prime_p: spk_elgamal_grp_gen_g: spk_elgamal_pub_key: (t cStringIOtStringIOtwriteRUR[ROR]ttimetctimeRRktalgo_pk_to_strR^RlRmR<RbRcRnRoRpRqRrRsRtRuRvRwtgetvalue(RXtsio((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR[s( !7!!!(RRRYRiRjReR~R[(((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR\s      tuser_idcBs#eZdZdZdZRS(cCstj|d|_dS(N(RURYRVtid(RX((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyRYs cCs||||!|_dS(N(R(RXR"R#Rz((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR~scCs tj|dd|jdS(Ns sid: (RUR[R(RX((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR[s(RRRYR~R[(((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyRs  tuser_attributecBs#eZdZdZdZRS(cCs#tj|d|_d|_dS(N(RURYRVtsub_typetdata(RX((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyRY#s  cCs=t||d\|_}|d}||||!|_dS(Ni(R)RR(RXR"R#Rz((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR~(s cCs3tj|ddt|jdt|jS(Ns s sub_type: s data: (RUR[RORRBR(RX((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR[-s(RRRYR~R[(((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR"s  t signaturecBskeZdZdZdZdZdZdZdZdZ dZ d Z d Z RS( cCs>tj|d|_d|_d|_d|_d|_dS(N(RURYRVR]tsig_typeR^t hash_algot hash_frag(RX((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyRY1s      cCsX|jdkr|jS|jt}|r3|dS|jt}|rP|dSdSdS(Nii(R]tkey_id_tget_hashed_subpaktSIG_SUB_TYPE_ISSUER_KEY_IDtget_unhashed_subpakRV(RXRS((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyRj9scCs1|jdkr|jS|jt}|dSdS(Nii(R]RRtSIG_SUB_TYPE_CREATE_TIME(RXRS((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyt creation_timeEscCs?|jdkrtdn|jt}|r;|dSdS(Nis$v3 signatures don't have expirationsii(R]RRtSIG_SUB_TYPE_KEY_EXPIRE(RXRS((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyt expirationLs cCs,x%|jD]}|d|kr |Sq WdS(Ni(thashed_subpaksRV(RXttypRS((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyRTscCs,x%|jD]}|d|kr |Sq WdS(Ni(tunhashed_subpaksRV(RXRRS((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyRZsc& Cs|t||\}}t||d\}}|tkrgt||d\}}|t|f|fS|tks|tkrt||d\}}||f|fS|tks|tkrt||d\}}||f|fS|t kr6t||d\}}t||d\} }||| f|fS|t kru||||d!} ||d}|| f|fS|t ks|t ks|t ks|tkrtdt||||d!} ||d}|| f|fS|tkrWt||d\} }t||d\} }|||d!}|d}|| | |f|fS|tkr|||d!}|d}||f|fS|tkrt||d\}}t||d\}}t||d\}}t||d\}}t||d\}}t||d\}}||||!}||}||||!}||}|||||||f|fS|tkrg||||d!D]}t|^q}||d}||f|fS|tkr||||d!}||d}||f|fS|tkrJt||d\}}||f|fS|tkr||||d!}||d}||f|fS|tkr||||d!}||d}||f|fS|tkr$t||d\}}|d}||||!}||}|||f|fS|tkr|d}|g} x?|dkrt||d\}!}| j|!|d}qFWt| |fS|tkr t||d\}"}t||d\}#}||||d!}$||d}||"|#|$f|fS|tkrI||||d!}%||d}||%f|fS||||d!}%||d}||%f|fS( NiicSs t|S(N(R2(R>((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR?usiiiii( R8R)RR'RytSIG_SUB_TYPE_EXPIRE_TIMERtSIG_SUB_TYPE_EXPORT_CERTtSIG_SUB_TYPE_REVOCABLEtSIG_SUB_TYPE_TRUST_SIGtSIG_SUB_TYPE_REGEXPtSIG_SUB_TYPE_PREF_SYMM_ALGOtSIG_SUB_TYPE_PREF_HASH_ALGOtSIG_SUB_TYPE_PREF_COMP_ALGOtSIG_SUB_TYPE_KEY_FLAGSR@RAtSIG_SUB_TYPE_REVOKE_KEYRtSIG_SUB_TYPE_NOTATIONtSIG_SUB_TYPE_KEY_SRV_PREFR2tSIG_SUB_TYPE_PREF_KEY_SRVRtSIG_SUB_TYPE_PRIM_USER_IDtSIG_SUB_TYPE_POLICY_URItSIG_SUB_TYPE_SGNR_USER_IDtSIG_SUB_TYPE_REVOKE_REASONtSIG_SUB_TYPE_FEATURESRNttupletSIG_SUB_TYPE_SIG_TARGETtSIG_SUB_TYPE_EMBEDDED_SIG(&RXR"R#tsublentsubtypettmR3tboolt trust_lvlt trust_amttexprt algo_listtclsRtfprinttk_idtflg1tflg2tflg3tflg4tname_lentval_lentnamtvalR>tprefsturlturit signer_idtrev_codetreas_lentreasR.tocttpublic_key_algoRthashtdat((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytdeserialize_subpacket`s   0'        .             cCs0x)|jD]}|dtkr |dSq WdS(spis_primary_user_id() returns true if this signature contains a primary user id subpacket with value trueii(RR(RXRS((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytis_primary_user_ids c Cs|dtkr%dtj|dS|dtkrGdt|dS|dtkrl|dredSdSn|dtkr|ddkrdS|ddkrd|d S|dd krd |d Sd |d|d fS|dtkrd |dS|dtkr|drd SdSn|dt krAdt|dS|dt krfdt t |dS|dt krd}|dt@r|d}n|t t|d dt|dS|dtkrdt|dS|dtkrd|dS|dtkr!dt t|dS|dtkrFdt t|dS|dtkrd}g}|ddd@r|jdn|dj|S|dtkrd|dS|dtkr|drdSdSn|dtkrd |dS|dtkrg}d}t|ddkr5|dd}n|t@rO|jd!n|t @ri|jd"n|t!@r|jd#n|t"@r|jd$n|t#@r|jd%n|t$@r|jd&nd'dj|S|dt%krd(|dS|dt&kr6t'j(|dd)}d*||d fS|dt)krg}t|dkr|d}|t*@r|jd+n|t*@}|dkr|jd,|qnx<t+d t|D]%} |jd-| d|| fqWd.dj|Sd/|dt|dfS(0Niscreation time: issignature expires: ssignature exportable: TRUEssignature exportable: FALSEstrust: ordinarystrust: introducer (%d)istrust: meta-introducer (%d)s trust: %d %dsregexp: ssignature revocable: TRUEssignature revocable: FALSEs key expires: s preferred symmetric algorithms: srevocation key: s (sensitive) t isissuer key id: s2notation: flags(%d, %d, %d, %d) name(%s) value(%s)spreferred hash algorithms: s"preferred compression algorithms: skey server preferences: is No-modifys, spreferred key server: %ssis primary user idsis not primary user idspolicy url: %ssmay certify other keyss may sign datasmay encrypt communicationssmay encrypt storages4private component may have been secret-sharing splits group keys key flags: s signer id: R*sreason for revocation: %s, %ssModification Detections[0]=0x%xs [%d]=0x%xs features: sunknown(%d): %s(,RRRRRHRRRRRRRTtalgo_sk_to_strRtREVOKE_KEY_CLASS_SENSRRBRRRtalgo_hash_to_strRtalgo_comp_to_strRRNR-RRRRR1tKEY_FLAGS1_MAY_CERTIFYtKEY_FLAGS1_MAY_SIGNtKEY_FLAGS1_MAY_ENC_COMMtKEY_FLAGS1_MAY_ENC_STRGtKEY_FLAGS1_PRIV_MAYBE_SPLITtKEY_FLAGS1_GROUPRRtrevoke_reason_to_strtgetRtPGP_FEATURE_1_MOD_DETECTtrange( RXtspR3Rtflagstflgs1RRRRS((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytsubpacket_to_strs      '               #cCst||d\|_}|jdkr6d|_n|jdkrt||d\}}t||d\|_}t||d\|_}t|j|_|||d!|_|d}t||d\|_}t||d\|_}nH|jdkr+t||d\|_}t||d\|_}t||d\|_}t||d\}}||}g|_ x8||kr|j ||\}}|j j |qWt||d\}}||}g|_ xT||kr'|j ||\}}|j j |qWnt d|j|ft||d\|_}|jtks}|jtkrt||\|_}n[|jtkrt||\|_}t||\|_}nt d|j|f|S(Niiiiis)unknown signature packet version %d at %ds4unknown public-key algorithm (%d) in signature at %d(R)R]R'RRRyRR^RRRRNRRfRRlRmR;trsa_sigRnt dsa_sig_rt dsa_sig_s(RXR"R#Rzthash_lent sub_paks_lent sub_paks_endR((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR~'sJ      cCs,tj}|jtj|d|jdt|jd|jdt|jd|jdkr|jdt j |j d|jdt |j dn|jdkrA|jdx/|jD]$}|jd |j|dqW|jd x2|jD]$}|jd |j|dqWn|jd t|jd|jd t|jd|jtks|jtkr|jd |jdt|jdn[|jtkr"|jd|jdt|jd|jdt|jdn|jS(Ns s version: stype: is timestamp: skey_id: ishashed subpackets: s sunhashed subpackets: s hash_algo: s hash_frag: s pk_algo: RSA s rsa_sig: s pk_algo: DSA s dsa_sig_r: s dsa_sig_s: (RRRRUR[ROR]tsig_type_to_strRRRRRBRRRRRRR<RR^RlRmRRnRRR(RXRRS((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR[Ps0 !! " % ! !( RRRYRjRRRRRRRR~R[(((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR0s      `  _ )tpgp_certificatecBsJeZdZdZdZeeZdZdZdZ RS(cCs1d|_d|_g|_g|_d|_dS(Ni(RVR]R\t revocationstuser_idstprimary_user_id(RX((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyRYps     cCsAtj}|jd|j|jdt|jj|jd|j|jt|jxT|j D]I}|jt|dx)|dD]}|jdt|qWqtWt |dr7xd|j D]V}|jd|jt|dx)|dD]}|jdt|qWqWn|j S( NsPGP Public Key Certificate v%d s Cert ID: %s sPrimary ID: %s iis t user_attrsR( RRRR]RBR\RjRRORthasattrRR(RXRtuidtsigtuattr((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR[ws    "cCs|j|jdjS(Ni(RRR(RX((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyt get_user_idscCs|jdkrE|jjdkr%dS|jj|jjdddS|jd}xK|dD]?}|jtkr]|j}|dkrdS|jj|Sq]WdSdS(Niiii<i(R]R\RkRRRtSIG_TYPE_PK_USER_GENR(RXtu_idRStexp((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyRs    cCsdS(Ni((RX((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR_sc Cs5|djtkr6tdtt|djn|d|_|jj|_|jdkr8d}x||jtkr||jdkrtd||jn||jt krtdtt ||jn|j j |||d}qjWx|t |kr4||jtkrlt |jdkrhtd|tt||jfqlPn||g}|d}d}d}x|t |kr ||jtkr ||jtttttfkrtd|tt ||jfn|j |||d}qW|jj |qWnd}g|_g|_g|_g|_|jj}x|t |krG||jtkrG||jd krtd ||jn||jt kr|j j ||nJ||jtkr|jj ||n td tt ||j|d}qtWd}x|t |kr||jtkr||g}d}d}|d}x|t |kr||jtkr||jtttttfkr td|tt ||jfn|j ||||j|kr||jr||j}||kr}t |j|_|}q}qn|d}qW|jj |qQ||jtkrv||g} d}|d}x|t |krb||jtkrb||jtttttfkrDtd |tt ||jfn| j |||d}qW|jj | qQ||jtkr||g} |d}d}|t |kr||jtkr||jt krd}| j |||d}n|t |kr+td |dn||jtksQ||jt!krztd|tt ||jfn| j |||d}|r|jj | q|jj | qQ||jtkr|j j |||d}qQPqQWt |jdkr1tdt"|jjn|S(sload(pkts) Initialize the pgp_certificate with a list of OpenPGP packets. The list of packets will be scanned to make sure they are valid for a pgp certificate.is6first PGP packet should be a public-key packet, not %siis'version 3 cert has version %d signatures"v3 cert revocation sig has type %ss#pgp packet %d is not user id, is %ss/signature %d doesn't bind user_id to key, is %sis'version 4 cert has version %d signaturesZv4 cert signature has type %s, supposed to be revocation signature or direct key signatures1signature %d doesn't bind user_attr to key, is %ss2subkey at index %d was not followed by a signatures3signature %d doesn't bind subkey to key, type is %ss,no user id packet was present in the cert %s(#RWtCTB_PKT_PK_CERTRRTRZR\R]t CTB_PKT_SIGRtSIG_TYPE_KEY_REVOKERRRNR1tCTB_PKT_USER_IDRRtSIG_TYPE_PK_USER_PERtSIG_TYPE_PK_USER_CAStSIG_TYPE_PK_USER_POStSIG_TYPE_CERT_REVOKEtdirect_key_sigstsubkeyst rvkd_subkeysRRjt SIG_TYPE_KEYRRRtCTB_PKT_USER_ATTRtCTB_PKT_PK_SUBtSIG_TYPE_SUBKEY_REVOKEtSIG_TYPE_SUBKEY_BINDRB( RXtpktstpkt_idxRt is_revokedRtcert_idtprim_user_id_sig_timetctt user_attrtsubkey((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytloads# #)  (")    (   (")   (")  8 &)  "( RRRYR[RtpropertyRRR_R(((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyRos      cCst||d\}}|t@tkrd}|t@tkrGd}n|t@tkr`d}n|t@tkryd}n|t@tkrd}nd}|dkrt|||\}}n|t@d?||fS|t@t krt||d\}}|dkr|t @||fS|dkr^t||d\}}|t @|dd>|d|fS|dkrt||d\}}|t @||fSt d |nt d ||fd S( sget_ctb(msg, idx) extracts a the "cypher type bit" information from message msg at index idx returns (type, len, new_idx) where type is the enumerated type of the packet, len is the length of the packet, and new_idx is the index of the next element in the messageiiiiiiiis=partial message bodies are not supported by this version (%d)s4unknown (not "normal") cypher type bit %d at byte %dN( R)t CTB_76_MASKt CTB_76_NORMALtCTB_PKT_LEN_MASKt CTB_PKT_LEN_1t CTB_PKT_LEN_2t CTB_PKT_LEN_4tCTB_PKT_LEN_UNDEFtCTB_PKTV2_MASKt CTB_76_NEWt CTB_PKT_MASKt Exception(R"R#R&tn_lenRzR6R7((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytget_ctb^s6       ! cCsd}d}|}xct|D]U}|t|d>A}x8tddD]'}|d>}|d@rI||A}qIqIWqW|d@S( NiiLiiiiii(RAR2R(R"t crc24_initt crc24_polytcrcRStj((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytcrc24s  cCs4g}d}t|}x||kr/t||\}}}d}|tks]|tkrit}nH|tkrt}n0|tkrt }n|t krt }n|r||_ |j |||trtj|jdqntdtt||f|j|||}qW|S(Nis s#unexpected pgp packet type %s at %d(R1RRVRRR\RRRRRRRWR~tdebugRR[RRTRZRN(R"tpkt_listR#tmsg_lenRWRztpkt((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytdecodes.          cCstd|jd}d}d}tj}xl|D]d}|sa|dkr:d}q:q:n|st|dkr:d}q:q:n|r|ddkrtj|dd!}d}t||d\}}tj|j} |j |t | krt d nt | } g} xQt| dkrtt } || _| j| } | j| g| d| +q$W|s| sd S| dS| S|j|q:W|sd SgS( sdecode_msg(msg) ==> list of OpenPGP "packet" objects Takes an ascii-armored PGP block and returns a list of objects each of which corresponds to a PGP "packets". A PGP message is a series of packets. You need to understand how packets are to be combined together in order to know what to do with them. For example a PGP "certificate" includes a public key, user id(s), and signature. cSs |jS(N(trstrip(R>((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR?ss is$-----BEGIN PGP PUBLIC KEY BLOCK-----it=iisbad checksum on pgp messageN(R@tsplitRRR1tbase64t decodestringR'RtcloseR"RR'Rtraw_keyRRNRVR(R"tmultit pgpkey_linestin_blocktin_datat block_bufR.tcsumRStcert_msgR$t cert_listtcertR((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyt decode_msgsL            cCsg}td|jd}d}d}x|D]}|si|dkrid}|d|7}q4qin|d|7}|dkr4d}t|d t}|r|j|nd}q4q4q4W|S( NcSs |jS(N(R((R>((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyR?ss iR*s$-----BEGIN PGP PUBLIC KEY BLOCK-----is%s s"-----END PGP PUBLIC KEY BLOCK-----R/(R@R*R8tTruetextend(R"tcertsR0R1tblockR.t thesecerts((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pytdecode_multiple_keyss&     t__main__(RRRR+RKRt ImportErrorRRRVR#RRRRRtCTB_PKT_PK_ENCRtCTB_PKT_SK_ENCtCTB_PKT_OP_SIGtCTB_PKT_SK_CERTRtCTB_PKT_SK_SUBtCTB_PKT_COMPRESSEDt CTB_PKT_ENCtCTB_PKT_MARKERt CTB_PKT_LITt CTB_PKT_TRUSTRRRtCTB_PKT_SYM_ENC_INTtCTB_PKT_MOD_DETECTRZRRRRRRltALGO_PK_RSA_ENC_ONLYRmRtRntALGO_PK_ELLIPTIC_CURVEt ALGO_PK_ECDSARst ALGO_PK_DHRt ALGO_SK_PLAINt ALGO_SK_IDEAt ALGO_SK_3DESt ALGO_SK_CAST5tALGO_SK_BLOWFISHtALGO_SK_SAFER_SK128tALGO_SK_DES_SKtALGO_SK_AES_128tALGO_SK_AES_192tALGO_SK_AES_256tALGO_SK_TWOFISH_256RtALGO_COMP_UNCOMPt ALGO_COMP_ZIPtALGO_COMP_ZLIBtALGO_COMP_BZIP2Rt ALGO_HASH_MD5tALGO_HASH_SHA1tALGO_HASH_RIPEMD160tALGO_HASH_SHA_DBLt ALGO_HASH_MD2tALGO_HASH_TIGER192tALGO_HASH_HAVAL_5_160tALGO_HASH_SHA256tALGO_HASH_SHA384tALGO_HASH_SHA512tALGO_HASH_SHA224RtSIG_TYPE_DOCUMENTtSIG_TYPE_DOCUMENT_CANONtSIG_TYPE_STANDALONERRRRRRRRRtSIG_TYPE_TIMESTAMPRRRRRRRRtSIG_SUB_TYPE_PLACEHOLDERRRRRRRRRRRRRRRRRtsig_sub_type_to_strtREVOKE_REASON_NONEtREVOKE_REASON_SUPERtREVOKE_REASON_COMPRtREVOKE_REASON_NOT_USEDtREVOKE_REASON_ID_INVALIDRRRRRRRtREVOKE_KEY_CLASS_MANDRRtpgp_feature_to_strR'R)R0R5R8R:R;RBRHRTtobjectRUR\RRRRRR"R'tFalseR8R>Rtsystopentargvtreadtpgp_cert(((s./usr/lib/python2.7/site-packages/yum/pgpmsg.pyts<                   r @ $ " D   &