Current File : //usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyc
�
�/�Oc@sdZdZddlZddlZejddkrWejddkrWddlTnddlTddlZddlm	Z	m
Z
mZd	�Zd
ej
fd��YZdefd
��YZdefd��YZid�Zedkrd�Zejdd�ndS(s(Self-test suite for Crypto.PublicKey.DSAs$Id$i����Niii(t*(tlist_test_casesta2b_hextb2a_hexcCs?t|t�r"dj|j��Std�j|j��SdS(s,Remove whitespace from a text or byte stringtN(t
isinstancetstrtjointsplittb(ts((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyt_sws&stDSATestcBs�eZed�Zed�Zed�Zed�Zed�Zed�Zed�Z	e
ed��Zed�Z
ed	�Zed
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(s�19131871 d75b1612 a819f29d 78d1b0d7 346f7aa7 7bb62a85
                9bfd6c56 75da9d21 2d3a36ef 1672ef66 0b8c7c25 5cc0ec74
                858fba33 f44c0669 9630a76b 030ee333s�626d0278 39ea0a13 413163a5 5b4cb500 299d5522 956cefcb
                3bff10f3 99ce2c2e 71cb9de5 fa24babf 58e5b795 21925c9c
                c42e9f6f 464b088c c572af53 e6d78802s�8df2a494 492276aa 3d25759b b06869cb eac0d83a fb8d0cf7
                cbb8324f 0d7882e5 d0762fc5 b7210eaf c2e9adac 32ab7aac
                49693dfb f83724c2 ec0736ee 31c80291s,c773218c 737ec8ee 993b4f2d ed30f48e dace915fs,2070b322 3dba372f de1c0ffc 7b2e3b49 8b260614s,358dad57 1462710f 50e254cf 1a376b2b deaadfbfs,0d516729 8202e49b 4116ac10 4fc3f415 ae52f917tabcs,a9993e36 4706816a ba3e2571 7850c26c 9cd0d89ds,8bac1ab6 6410435c b7181f95 b16ab97c 92b341c0s,41e2345f 1f56df24 58f426d1 55b4ba2d b6dcd8c8cCsIddlmaddlmaddlmam}mat|_dS(Ni����(tDSA(tRandom(t
bytes_to_longtinversetsize(	tCrypto.PublicKeyRtCryptoRtCrypto.Util.numberRRRtdsa(tselfR((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pytsetUpKscCs<|jjd�}|j|�|j�}|j|�dS(s7DSA (default implementation) generated key (1 argument)iN(Rtgeneratet_check_private_keyt	publickeyt_check_public_key(RtdsaObjtpub((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyttest_generate_1argSs
cCsH|jjdtj�j�}|j|�|j�}|j|�dS(s8DSA (default implementation) generated key (2 arguments)iN(RRRtnewtreadRRR(RRR((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyttest_generate_2argZs
cCsxg|j|j|j|jfD]}tt|��^q\}}}}|jj||||f�}|j|�dS(s6DSA (default implementation) constructed key (4-tuple)N(	tytgtptqRRRt	constructt_test_verification(RtparamR#R$R%R&R((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyttest_construct_4tupleasIcCs�g|j|j|j|j|jfD]}tt|��^q%\}}}}}|jj|||||f�}|j	|�|j
|�dS(s6DSA (default implementation) constructed key (5-tuple)N(R#R$R%R&txRRRR't
_test_signingR((RR)R#R$R%R&R+R((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyttest_construct_5tuplegsR!
cCs�|jd|j��|jd|j��|jd|j��|jd|j��|j|j|jj�|j|j|jj�|j|j|jj�|j|j	|jj	�|j|j
|jj
�|jd|j|j	k�|jdt|j	��|jd|jd|j	�|j|jt|j|j
|j��|jdd|j
kov|j	kn�dS(Niii�(
tassertEqualthas_privatetcan_signtcan_encryptt	can_blindR#tkeyR$R%R&R+Rtpow(RR((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyRns(cCs�t|j�}t|j�}|jd|j��|jd|j��|jd|j��|jd|j��|j|j|j	j�|j|j
|j	j
�|j|j|j	j�|j|j|j	j�|jdt
|d��|jdt
|j	d��|jd|j|jk�|jdt|j��|jd|jd|j�|jt|j||�|j|j�|j�kt�|j|j�|j�kt�dS(NiiR+i�(Rtktm_hashR.R/R0R1R2R#R3R$R%R&thasattrRtassertRaisest	TypeErrortsignRtTruetFalse(RRR5R6((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR�s$"cCs�t|j�}t|j�}tt|j��}tt|j��}|j||�\}}|j||f||f�dS(N(RR5R6RtrR
R:R.(RRR5R6R=R
tr_outts_out((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR,�scCs�t|j�}tt|j��}tt|j��}|jd|j|||f��|jd|j|td�||f��dS(Niit(RR6RR=R
R.tverifyR	(RRR6R=R
((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR(�s
"(t__name__t
__module__RR#R$R%R&R+R5t	k_inverseRR	tmR6R=R
RRR"R*R-RRR,R((((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR-s.										 	tDSAFastMathTestcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs&tj|�tjdt�|_dS(Nt
use_fast_math(RRRtDSAImplementationR;R(R((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR�s
cCstj|�dS(s9DSA (_fastmath implementation) generated key (1 argument)N(RR(R((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR�scCstj|�dS(s:DSA (_fastmath implementation) generated key (2 arguments)N(RR"(R((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR"�scCstj|�dS(s8DSA (_fastmath implementation) constructed key (4-tuple)N(RR*(R((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR*�scCstj|�dS(s8DSA (_fastmath implementation) constructed key (5-tuple)N(RR-(R((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR-�s(RBRCRRR"R*R-(((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyRF�s
				tDSASlowMathTestcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs&tj|�tjdt�|_dS(NRG(RRRRHR<R(R((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR�s
cCstj|�dS(s9DSA (_slowmath implementation) generated key (1 argument)N(RR(R((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR�scCstj|�dS(s:DSA (_slowmath implementation) generated key (2 arguments)N(RR"(R((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR"�scCstj|�dS(s8DSA (_slowmath implementation) constructed key (4-tuple)N(RR*(R((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR*�scCstj|�dS(s8DSA (_slowmath implementation) constructed key (5-tuple)N(RR-(R((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyR-�s(RBRCRRR"R*R-(((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyRI�s
				cCs�g}|tt�7}y$ddlm}|tt�7}Wn�tk
r�ddlm}ddl}t	j
jt	j
jt	j
j
|j|j����d|d��}t	j
j|�r�tddd|��q�nX|tt�7}|S(	Ni����(t	_fastmath(tget_config_vars/../../PublicKey/_fastmathtSOs-While the _fastmath module exists, importing s<it failed. This may point to the gmp or mpir shared library s.not being in the path. _fastmath was found at (RRRRJRFtImportErrortdistutils.sysconfigRKtinspecttostpathtnormpathtdirnametabspathtgetfiletcurrentframetexistsRI(tconfigttestsRJRKROt_fm_path((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyt	get_tests�s
	>t__main__cCstjt��S(N(tunittestt	TestSuiteR[(((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyt<lambda>�stdefaultTesttsuite(t__doc__t__revision__tsysRPtversion_infotCrypto.Util.py21compattCrypto.Util.py3compatR]tCrypto.SelfTest.st_commonRRRRtTestCaseRRFRIR[RBRatmain(((sH/usr/lib64/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.pyt<module>s &

	�