????

Your IP : 216.73.216.152


Current Path : /proc/self/root/proc/self/root/lib/python2.7/site-packages/wheel/signatures/
Upload File :
Current File : //proc/self/root/proc/self/root/lib/python2.7/site-packages/wheel/signatures/__init__.pyc

�
��]c@s�dZddgZddlZddlmZmZmZmZda	dZ
d�Zd	�Zd
d�Z
d�Zd
�ZdS(s5
Create and verify jws-js format Ed25519 signatures.
tsigntverifyi����Ni(turlsafe_b64decodeturlsafe_b64encodetnativetbinarytEd25519cCsNtsJyddlaWn'ttfk
r?ddlmanXt�ntS(s&Lazy import-and-test of ed25519 modulei����Ni(t	ed25519py(t	ed25519lltImportErrortOSErrortRttest(((s8/tmp/pip-build-tmgNo5/wheel/wheel/signatures/__init__.pyt
get_ed25519lls
c	Cs�t�itd6itd6tt|j��d6d6}tttj|dt���}tttj|dt���}dj	||f�}t
j||j�}|t
j
 }t|�}iit|�d6t|�d6gd	6t|�d
6S(s_Return a JWS-JS format signature given a JSON-serializable payload and 
    an Ed25519 keypair.talgtktytvktjwkt	sort_keyst.theadert	signaturet
recipientstpayload(R
tALGRRRRtjsontdumpstTruetjoinRtcrypto_signtsktSIGNATUREBYTES(	RtkeypairRtencoded_headertencoded_payloadt
secured_inputtsig_msgRtencoded_signature((s8/tmp/pip-build-tmgNo5/wheel/wheel/signatures/__init__.pyRs !!
RcCs|st|��ndS(N(t
ValueError(t	conditiontmessage((s8/tmp/pip-build-tmgNo5/wheel/wheel/signatures/__init__.pyt
assertTrue4scCs�t�|d}t|d�}g}x�|D]�}tt|�dkdj|��t|d�}t|d�}tjtt|���}t|dt	kdj|d��d|d	kr�d
|d	kr�|d	d|d	d
<nt|d	d
t	kdj|d	d
��tt|d	d��}d
j
||f�}	t|�}
|
|	}ttj||��}|j
d
�\}
}t|
�}
tt|
��}|jtj|��q.Wt|�}tjtt|���}||fS(s�Return (decoded headers, payload) if all signatures in jwsjs are
    consistent, else raise ValueError.
    
    Caller must decide whether the keys are actually trusted.RRisUnknown recipient key {0}RRRsUnexpected algorithm {0}RRsUnexpected key type {0}RR(R
RR)tlentformatRtloadsRRRRRtcrypto_sign_opentsplittappend(tjwsjsRR"theaderst	recipientthtsRRR#tsigR$tverified_inputtverified_headertverified_payloadtdecoded_headerR((s8/tmp/pip-build-tmgNo5/wheel/wheel/signatures/__init__.pyR8s6

" 
cCs�tj�}idd6}tjtjt||���}t|�|dcd7<yt|�Wntk
run
Xtd��dS(Nt	onstartupRRtxs+No error from bad wheel.signatures payload.(	Rtcrypto_sign_keypairRR,RRRR&tRuntimeError(tkpRR0((s8/tmp/pip-build-tmgNo5/wheel/wheel/signatures/__init__.pyR^s
!

(t__doc__t__all__RtutilRRRRtNoneRRR
RR)RR(((s8/tmp/pip-build-tmgNo5/wheel/wheel/signatures/__init__.pyt<module>s"	
		&