Ñò šà>c@skdZddkTddklZdefd„ƒYZd d„Zd„Zde fd „ƒYZ e Z d S( s9$Id: ElGamal.py,v 1.9 2003/04/04 19:44:26 akuchling Exp $iÿÿÿÿ(t*(tnumberterrorcBseZRS((t__name__t __module__(((s>/usr/lib64/python2.6/site-packages/Crypto/PublicKey/ElGamal.pyRscCs¸tƒ}|o|dƒntt||ƒƒ|_|o|dƒn|dt|dƒƒd@}|djo|d}nxXtt||ƒƒ|_|i|ijoPn|d|}|djo d}q‡q‡|o|dƒnx/|dt|dƒƒ}|djoPq÷q÷xXtt||ƒƒ|_|i|ijoPn|d|}|djo d}q)q)|o|d ƒnt|i|i|iƒ|_|S( sígenerate(bits:int, randfunc:callable, progress_func:callable) Generate an ElGamal key of length 'bits', using 'randfunc' to get random data and 'progress_func', if present, to display the progress of the key generation. sp sg ii?iisx isy ( t ElGamalobjtbignumtgetPrimetptordtgtxtpowty(tbitstrandfunct progress_functobjtsize((s>/usr/lib64/python2.6/site-packages/Crypto/PublicKey/ElGamal.pytgeneratesB       cCsktƒ}t|ƒdjo td‚nx;tt|ƒƒD]'}|i|}t||||ƒq<W|S(sŸconstruct(tuple:(long,long,long,long)|(long,long,long,long,long))) : ElGamalobj Construct an ElGamal key from a 3- or 4-tuple of numbers. iis%argument for construct() wrong length(ii(RtlenRtrangetkeydatatsetattr(ttupleRtitfield((s>/usr/lib64/python2.6/site-packages/Crypto/PublicKey/ElGamal.pyt constructBs   RcBsYeZddddgZd„Zd„Zd„Zd„Zd„Zd „Zd „Z RS( RR R R cCsEt|i||iƒ}|t|i||iƒ|i}||fS(N(R R RR (tselftMtKtatb((s>/usr/lib64/python2.6/site-packages/Crypto/PublicKey/ElGamal.pyt_encryptSs#cCs^t|dƒp td‚nt|d|i|iƒ}|dt||iƒ|i}|S(NR s(Private key not available in this objectii(thasattrRR R Rtinverse(RRtaxt plaintext((s>/usr/lib64/python2.6/site-packages/Crypto/PublicKey/ElGamal.pyt_decryptXs  !cCsºt|dƒp td‚n|id}t||ƒdjo td‚nt|i||iƒ}||i||}x|djo||}q}W|t||ƒ|}||fS(NR s(Private key not available in this objectisBad K value: GCD(K,p-1)!=1i(R"RRtGCDR R R R#(RRRtp1RttR ((s>/usr/lib64/python2.6/site-packages/Crypto/PublicKey/ElGamal.pyt_sign_s    cCsrt|i|d|iƒ}|t|d|d|iƒ|i}t|i||iƒ}||jodSdS(Nii(R R RR (RRtsigtv1tv2((s>/usr/lib64/python2.6/site-packages/Crypto/PublicKey/ElGamal.pyt_verifyks ( cCsti|iƒdS(sBReturn the maximum number of bits that can be handled by this key.i(RRR(R((s>/usr/lib64/python2.6/site-packages/Crypto/PublicKey/ElGamal.pyRsscCst|dƒodSdSdS(sQReturn a Boolean denoting whether the object contains private components.R iiN(R"(R((s>/usr/lib64/python2.6/site-packages/Crypto/PublicKey/ElGamal.pyt has_privatewscCst|i|i|ifƒS(s?Return a new key object containing only the public information.(RRR R (R((s>/usr/lib64/python2.6/site-packages/Crypto/PublicKey/ElGamal.pyt publickeys( RRRR!R&R*R.RR/R0(((s>/usr/lib64/python2.6/site-packages/Crypto/PublicKey/ElGamal.pyRPs     N( t __revision__tCrypto.PublicKey.pubkeyt Crypto.UtilRt ExceptionRtNoneRRtpubkeyRtobject(((s>/usr/lib64/python2.6/site-packages/Crypto/PublicKey/ElGamal.pyt s  , 4