Current File : //usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pyo
�
�/�Oc@s?dZddlZddlZddlTddd��YZdS(s$Id$i����N(t*tpubkeycBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�ZRS(sxAn abstract class for a public key object.

    :undocumented: __getstate__, __setstate__, __eq__, __ne__, validate
    cCsdS(N((tself((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pyt__init__&scCsG|j}x7|jD],}|j|�rt||�||<qqW|S(s�To keep key objects platform-independent, the key data is
        converted to standard Python long integers before being
        written out.  It will then be reconverted as necessary on
        restoration.(t__dict__tkeydatathas_keytlong(Rtdtkey((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pyt__getstate__)s
	cCsAx:|jD]/}|j|�r
t||�|j|<q
q
WdS(s�On unpickling a key object, the key data is converted to the big
number representation being used, whether that is Python long
integers, MPZ objects, or whatever.N(RRtbignumR(RRR	((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pyt__setstate__3scCs�d}t|tj�r-t|�}d}nt|tj�rNt|�}n|j||�}|ryttt|��S|SdS(sjEncrypt a piece of data.

        :Parameter plaintext: The piece of data to encrypt.
        :Type plaintext: byte string or long

        :Parameter K: A random parameter required by some algorithms
        :Type K: byte string or long

        :Return: A tuple with two items. Each item is of the same type as the
         plaintext (string or long).
        iiN(t
isinstancettypest
StringTypet
bytes_to_longt_encryptttupletmapt
long_to_bytes(Rt	plaintexttKt	wasStringt
ciphertext((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pytencrypt:s	cCsd}t|tj�s$|f}nt|dtj�rXttt|��}d}n|j|�}|rwt|�S|SdS(s.Decrypt a piece of data. 

        :Parameter ciphertext: The piece of data to decrypt.
        :Type ciphertext: byte string, long or a 2-item tuple as returned by `encrypt`

        :Return: A byte string if ciphertext was a byte string or a tuple
         of byte strings. A long otherwise.
        iiN(	R
Rt	TupleTypeRRRRt_decryptR(RRRR((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pytdecryptOs		
cCsm|j�std��nt|tj�r<t|�}nt|tj�r]t|�}n|j||�S(s
Sign a piece of data.

        :Parameter M: The piece of data to encrypt.
        :Type M: byte string or long

        :Parameter K: A random parameter required by some algorithms
        :Type K: byte string or long

        :Return: A tuple with two items.
        s(Private key not available in this object(thas_privatet	TypeErrorR
RRRt_sign(RtMR((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pytsignascCs1t|tj�r!t|�}n|j||�S(s>Verify the validity of a signature.

        :Parameter M: The expected message.
        :Type M: byte string or long

        :Parameter signature: The signature to verify.
        :Type signature: tuple with two items, as return by `sign`

        :Return: True if the signature is correct, False otherwise.
        (R
RRRt_verify(RR t	signature((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pytverifyrscCstjdt�dS(Ns0validate() method name is obsolete; use verify()(twarningstwarntDeprecationWarning(RR R#((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pytvalidate�s	cCsxd}t|tj�r-t|�}d}nt|tj�rNt|�}n|j||�}|rpt|�S|SdS(s&Blind a message to prevent certain side-channel attacks.
       
        :Parameter M: The message to blind.
        :Type M: byte string or long

        :Parameter B: Blinding factor.
        :Type B: byte string or long

        :Return: A byte string if M was so. A long otherwise.
        iiN(R
RRRt_blindR(RR tBRtblindedmessage((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pytblind�s	
cCsxd}t|tj�r-t|�}d}nt|tj�rNt|�}n|j||�}|rpt|�S|SdS(s�Unblind a message after cryptographic processing.
        
        :Parameter M: The encoded message to unblind.
        :Type M: byte string or long

        :Parameter B: Blinding factor.
        :Type B: byte string or long
        iiN(R
RRRt_unblindR(RR R*Rtunblindedmessage((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pytunblind�s		
cCsdS(s(Tell if the algorithm can deal with cryptographic signatures.

        This property concerns the *algorithm*, not the key itself.
        It may happen that this particular key object hasn't got
        the private information required to generate a signature.

        :Return: boolean
        i((R((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pytcan_sign�s	cCsdS(sTell if the algorithm can deal with data encryption.
       
        This property concerns the *algorithm*, not the key itself.
        It may happen that this particular key object hasn't got
        the private information required to decrypt data.

        :Return: boolean
        i((R((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pytcan_encrypt�s	cCsdS(sTell if the algorithm can deal with data blinding.
       
        This property concerns the *algorithm*, not the key itself.
        It may happen that this particular key object hasn't got
        the private information required carry out blinding.

        :Return: boolean
        i((R((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pyt	can_blind�s	cCsdS(s_Tell the maximum number of bits that can be handled by this key.

        :Return: int
        i((R((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pytsize�scCsdS(sSTell if the key object contains private components.

        :Return: bool
        i((R((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pyR�scCs|S(skConstruct a new key carrying only the public information.

        :Return: A new `pubkey` object.
        ((R((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pyt	publickey�scCs|j�|j�kS(sF__eq__(other): 0, 1
        Compare us to other for equality.
        (R
(Rtother((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pyt__eq__�scCs|j|�S(sH__ne__(other): 0, 1
        Compare us to other for inequality.
        (R6(RR5((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pyt__ne__�s(t__name__t
__module__t__doc__RR
RRRR!R$R(R,R/R0R1R2R3RR4R6R7(((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pyR!s&		
															((t__revision__RR%tCrypto.Util.numberR(((s=/usr/lib64/python2.7/site-packages/Crypto/PublicKey/pubkey.pyt<module>s