ok

Mini Shell

Direktori : /lib64/python2.7/site-packages/M2Crypto/PGP/
Upload File :
Current File : //lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyc

�

�1Mc@s4dZddlZddlZyddlmZWn!ek
rUddlmZnXddlmZmZddl	m
Z
ddlTd.Zd/Z
d0Zdd1d��YZd
efd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd ��YZied!6ed"6ed#6ed$6ed%6ed&6ed'6ed(6ed)6d!e6d"e6d#e6d$e6d%e6d&e6d'e6d(e6d)e6Zd*d2d+��YZd,�Zd-�ZdS(3seM2Crypto PGP2.

This module implements PGP packets per RFC1991 and various source distributions.

Each packet type is represented by a class; packet classes derive from 
the abstract 'packet' class. 

The 'message digest' packet type, mentioned but not documented in RFC1991,
is not implemented.

Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved.i����N(tStringIO(tEVPtRSA(toctx_to_num(t*sststpacketcBs\eZd	d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�ZRS(
cCsPddl}|jdt�||_|dk	rCt|�|_n	d|_dS(Ni����sVDeprecated. No maintainer for PGP. If you use this, please inform M2Crypto maintainer.(twarningstwarntDeprecationWarningtctbtNoneRtbody(tselfR
RR((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyt__init__%s	cCsdS(Ni((R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pytvalidate/scCstd|jf�dS(Ns%s.pack(): abstract method(tNotImplementedErrort	__class__(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pytpack2scCs$t|d�rt|j�SdSdS(Nt_version(thasattrtordRR(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pytversion5s
cCs.t|d�r&tjd|j�dSdSdS(Nt
_timestamps>Li(RtstructtunpackRR(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyt	timestamp;scCs.t|d�r&tjd|j�dSdSdS(Nt	_validitys>Hi(RRRRR(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pytvalidityAscCst|d�r|jSdSdS(Nt_pkc(RRR(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pytpkcGscCsj|dkrdt|�fS|dkr>dtjd|�fS|d
ksPt�dtjd	|�fSdS(Niiiis>Hli is>Ll(tchrRRtAssertionError(R
tlenf((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyt_llfMscCs#t|j}td|d>B|B�S(Niiii�(t_FACTORYRR(R
tllftctbv((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyt_ctbVs
N(t__name__t
__module__RRRRRRRRR"R&(((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR$s
								tpublic_key_packetcBs&eZdd�Zd�Zd�ZRS(cCstj|||�|jdk	r|jjd�|_|jjd�|_|jjd�|_|jjd�|_|jjd�|_	t
jd|j	�ddd}|jj|�|_|jjd�|_
t
jd|j
�ddd}|jj|�|_ndS(Niiis>Hiii(RRRRtreadRRRRt_nlenRRt_nt_elent_e(R
R
Rtnlentelen((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR\s!!cCs	|jdkr�t�|_|jj|j�|jj|j�|jj|j�|jj|j�|jj|j�|jj|j	�|jj|j
�|jj|j�n|jj�|_|j
t|j��\}}|j|�}d|||jfS(Ns%s%s%s(RRRtwriteRRRRR+R,R-R.tgetvalueR"tlenR&(R
R$R!R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyRlscCs
|jj�S(N(t_pubkeytpub(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pytpubkey|sN(R'R(RRRR6(((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR)[s	ttrust_packetcBseZdd�ZRS(cCs;tj|||�|dk	r7|jjd�|_ndS(Ni(RRRRR*ttrust(R
R
R((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR�sN(R'R(RR(((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR7�st
userid_packetcBs&eZdd�Zd�Zd�ZRS(cCs/tj|||�|dk	r+||_ndS(N(RRRt_userid(R
R
R((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR�scCsp|jdkrbt�|_|jjtt|j���|jj|j�|jj�|_n|j|jS(N(	RRRR1RR3R:R2R
(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR�scCs|jS(N(R:(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pytuserid�sN(R'R(RRRR;(((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR9�s	tcomment_packetcBseZdd�Zd�ZRS(cCs8tj|||�|dk	r4|jj�|_ndS(N(RRRRR2tcomment(R
R
R((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR�scCsp|jdkrbt�|_|jjtt|j���|jj|j�|jj�|_n|j|jS(N(	RRRR1RR3R=R2R
(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR�sN(R'R(RRR(((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR<�stsignature_packetcBs&eZdd�Zd�Zd�ZRS(cCs�tj|||�|dk	r�|jjd�|_|jjd�|_|jjd�|_|jjd�|_|jjd�|_	|jjd�|_
|jjd�|_|jjd�|_|jj�|_
ndS(Niiii(RRRRR*Rt
_len_md_stufft_classificationRt_keyidRt_md_algot
_md_chksumt_sig(R
R
R((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR�scCs|jdkr�t�|_|jj|j�|jj|j�|jj|j�|jj|j�|jj|j�|jj|j	�|jj|j
�|jj|j�|jj|j�|jj
�|_n|jtt��\}}|j|B|_d|j||jfS(Ns%s%s%s(RRRR1RR?R@RRARRBRCRDR2R"R3R
(R
R$R!((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR�scCs*|jtkrdS|jdkr&dSdS(Ns(Rt_OK_VERSIONRR?(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR�sN(R'R(RRRR(((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR>�s
	tprivate_key_packetcBseZdd�Zd�ZRS(cCs�tj|||�|dk	r�|jjd�|_|jjd�|_|jjd�|_|jjd�|_|jjd�|_	t
jd|j	�ddd}|jj|�|_|jjd�|_
t
jd|j
�ddd}|jj|�|_|jjd�|_|jdkrE|jjd�|_n	d|_x�d	d
ddgD]n}|jjd�}t|d
|d|�t
jd|�ddd}t|d
||jj|��qaW|jjd�|_ndS(Niiis>Hiiistdtptqtut_R3(RRRRR*RRRRR+RRR,R-R.t_ciphert_ivtsetattrt_cksum(R
R
RR/R0tparamt_plentplen((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR�s,!!	$cCs
t|j�S(N(RRL(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pytis_encrypted�sN(R'R(RRRS(((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyRF�st
cke_packetcBseZdd�ZRS(cCsbtj|||�|dk	r^|jjd�|_|jjd�|_|jj�|_ndS(Nii(RRRRR*RMROt_ctxt(R
R
R((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR�s
N(R'R(RR(((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyRT�st
pke_packetcBseZdd�ZRS(cCs�tj|||�|dk	r�|jjd�|_|jjd�|_t|jjd��|_t	j
d|jjd��ddd}t|jj|��|_ndS(Niis>Hiii(
RRRRR*RRARRRRRt_dek(R
R
Rtdeklen((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR�s*N(R'R(RR(((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyRV�stliteral_packetcBseZdd�ZRS(cCswtj|||�|dk	rs|jjd�|_|jjd�}|jj|�|_|jjd�|_ndS(Nii(RRRRR*tfmodetfnametftime(R
R
Rtfnlen((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR	sN(R'R(RR(((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyRYstcompressed_packetcBs#eZd�Zd�Zd�ZRS(cCsGtj||d�tdk	rC|jd�|_|j�|_ndS(Nti(RRRRR*talgotdata(R
R
tstream((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyRscCs
|jdkS(Ns(R`(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyRscCs7ddl}|jd�}t|j|j��}|S(Ni����i�(tzlibt
decompressobjRt
decompressRa(R
RctdecompRb((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyt
uncompresss(R'R(RRRg(((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR^s		iiiii	iii
it
packet_streamcBs/eZd�Zd�Zdd�Zd�ZRS(cCs||_d|_d|_dS(Ni(RbRt
under_currentt_count(R
tinput((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyRAs		cCs0|jj�|jdk	r,|jj�ndS(N(RbtcloseRiR(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyRlFs
ic	Cs�xM|jjd�}|sdSt|�}t|�r;Pq|rGqqt�q|d@d?}|tkr�|j|_t||j�}|j	�|_|j�S|d@}|dkr�t|jjd��}nk|dkrt
jd|jjd��d}n:|dkr4t
jd|jjd��d}n	td	�|jj|�}|sht|�|krttd
�n|jj
�|_yt|||�SWntk
r�t||�SXdS(Nii<iiis>Hs>Lisimpossible casescorrupted packet(RbR*RRtis_ctbtXXXErrortCTB_COMPRESSED_DATARiR^RgRRR3ttellRjR#tKeyErrorR(	R
tkeep_tryingtctb0R
tctbttcpR$R!R((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyR*Ks@	

%%	
cCs|jS(N(Rj(R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pytcountts(R'R(RRlR*Rv(((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyRh@s		)cCs|d@S(Ni�((R
((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyRmwscCstd|d>B|B�S(Niiii�(R(tvalueR$((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pytmake_ctbzs(ss(s(s(((t__doc__Rttimet	cStringIORtImportErrortM2CryptoRRt
M2Crypto.utilRt	constantsREt_OK_VALIDITYt_OK_PKCRR)R7R9R<R>RFRTRVRYR^R#RhRmRx(((s9/usr/lib64/python2.7/site-packages/M2Crypto/PGP/packet.pyt<module>sX

7%'#	
7	

Zerion Mini Shell 1.0