�
o�
@s�ddkZddklZddklZy+ddkZeiZeidd�Z Wn@e
j
o4dZddkZddkZedd�Z nXd�Z
d�Zd efd
��YZdS(i�N(tutil(t_cCsKti|||d|d|�}|i�ptitd���n|S(Nt cert_reqstca_certssssl connection failed(tssltwrap_sockettcipherRtAbortR(tsocktkeyfiletcertfileRRt sslsocket((s@/sys/lib/python/lib/python2.5/site-packages/mercurial/sslutil.pytssl_wrap_sockets
icCsqtitd�ptitd���n|otitd���nti|||�}ti||�S(NRsPython SSL support not founds(certificate checking requires Python 2.6(RtsafehasattrtsocketRRRthttplibt
FakeSocket(Rtkey_filet cert_fileRRR((s@/sys/lib/python/lib/python2.5/site-packages/mercurial/sslutil.pyRs csw|ptd�Sn|i���fd�}|idg�}|o�g}|D]*\}}|djo||i�qTqT~}x#|D]}||�od
Sq�q�W|otd�di|�Sq�nx�|idg�D]�} | d\}}|d jo`y|i�id
�}
Wntj
otd�SnX||
�od
Sntd�|
Sq�q�td�S(s�Verify that cert (in socket.getpeercert() format) matches hostname.
CRLs is not handled.
Returns error message if any problems are found and None on success.
sno certificate receivedcs8|�jp+d�jo|d�idd�djS(Nt.s*.i(tsplit(tcertname(tdnsname(s@/sys/lib/python/lib/python2.5/site-packages/mercurial/sslutil.pytmatchdnsname3s
tsubjectAltNametDNSscertificate is for %ss, tsubjectit
commonNametasciis IDN in certificate not supporteds4no commonName or subjectAltName found in certificateN(RtlowertgettNonetjointencodetUnicodeEncodeError(tcertthostnameRtsant_[1]tkeytvaluet certnamestnametsR((Rs@/sys/lib/python/lib/python2.5/site-packages/mercurial/sslutil.pyt_verifycert*s2>
cCs�|idd�}|id|�}|oa|oYti|�}tii|�ptitd�|��nh|d<td<SnhS(Ntwebtcacertsthostfingerprintsscould not find web.cacerts: %sRR( tconfigRt
expandpathtostpathtexistsRRt
CERT_REQUIRED(tuithostR.thostfingerprint((s@/sys/lib/python/lib/python2.5/site-packages/mercurial/sslutil.pyt sslkwargsUs
t validatorcBseZd�Zd�ZRS(cCs||_||_dS(N(R6R7(tselfR6R7((s@/sys/lib/python/lib/python2.5/site-packages/mercurial/sslutil.pyt__init__bs cCsm|i}|iidd�}|iid|�}t|dt�pc|otitd�|��n|iiddt �o|ii
td�|�ndSn|i�ptitd �|��n|it �}|ptitd
�|��nti
|�i�}dig}tdt|�d
�D]}||||d
!q>~�} |or|i�|idd�i�jo/titd�|| fdtd���n|iid|| f�n�|ogt|i�|�}
|
o3titd�||
fdtd�| ��n|iid|�n!|ii
td�|| f�dS(NR-R.R/tgetpeercerts:host fingerprint for %s can't be verified (Python too old)R6treportoldssls?warning: certificate for %s can't be verified (Python too old)
s%s ssl connection errors-%s certificate error: no certificate receivedt:iits0certificate for %s has unexpected fingerprint %sthints#check hostfingerprint configurations&%s certificate matched fingerprint %s
s%s certificate error: %ssDconfigure hostfingerprint %s or use --insecure to connect insecurelys%%s certificate successfully verified
spwarning: %s certificate with fingerprint %s not verified (check hostfingerprints or web.cacerts config setting)
(R7R6R0tgetattrtFalseRRRt
configbooltTruetwarnRR=tsha1t hexdigestR txrangetlenRtreplacetdebugR,(R;RR7R.R8tpeercerttpeerfingerprintR&txtnicefingerprinttmsg((s@/sys/lib/python/lib/python2.5/site-packages/mercurial/sslutil.pyt__call__fsJ
:
(t__name__t
__module__R<RR(((s@/sys/lib/python/lib/python2.5/site-packages/mercurial/sslutil.pyR:as (R2t mercurialRtmercurial.i18nRRR5t CERT_NONERRtImportErrorRRR,R9tobjectR:(((s@/sys/lib/python/lib/python2.5/site-packages/mercurial/sslutil.pys<module> s
+
|