Ñò
BwLc           @   s?   d  Z  d d k Z d d k Z d d k Td d d „  ƒ  YZ d S(   s   $Id$iÿÿÿÿN(   t   *t   pubkeyc           B   sª   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s   d  S(   N(    (   t   self(    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   __init__"   s    c         C   sI   |  i  } x9 |  i D]. } | i | ƒ o t | | ƒ | | <q q W| 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__t   keydatat   has_keyt   long(   R   t   dt   key(    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   __getstate__%   s    	
  c         C   sC   x< |  i  D]1 } | i | ƒ o t | | ƒ |  i | <q
 q
 Wd S(   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(   R   R   t   bignumR   (   R   R   R	   (    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   __setstate__/   s    
  c         C   s‡   d } t  | t i ƒ o t | ƒ } d } n t  | t i ƒ o t | ƒ } n |  i | | ƒ } | o t t t | ƒ ƒ S| Sd S(   s­   encrypt(plaintext:string|long, K:string|long) : tuple
        Encrypt the string or integer plaintext.  K is a random
        parameter required by some algorithms.
        i    i   N(   t
   isinstancet   typest
   StringTypet   bytes_to_longt   _encryptt   tuplet   mapt   long_to_bytes(   R   t	   plaintextt   Kt	   wasStringt
   ciphertext(    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   encrypt6   s     
 c         C   s…   d } t  | t i ƒ p | f } n t  | d t i ƒ o t t t | ƒ ƒ } d } n |  i | ƒ } | o t | ƒ S| Sd S(   sc   decrypt(ciphertext:tuple|string|long): string
        Decrypt 'ciphertext' using this key.
        i    i   N(	   R   R   t	   TupleTypeR   R   R   R   t   _decryptR   (   R   R   R   R   (    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   decryptD   s     
 c         C   ss   |  i  ƒ  p t d ƒ ‚ n t | t i ƒ o t | ƒ } n t | t i ƒ o t | ƒ } n |  i | | ƒ S(   sµ   sign(M : string|long, K:string|long) : tuple
        Return a tuple containing the signature for the message M.
        K is a random parameter required by some algorithms.
        s(   Private key not available in this object(   t   has_privatet	   TypeErrorR   R   R   R   t   _sign(   R   t   MR   (    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   signQ   s      c         C   s3   t  | t i ƒ o t | ƒ } n |  i | | ƒ S(   s¦   verify(M:string|long, signature:tuple) : bool
        Verify that the signature is valid for the message M;
        returns true if the signature checks out.
        (   R   R   R   R   t   _verify(   R   R    t	   signature(    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   verify\   s     c         C   s   t  i d t ƒ d  S(   Ns0   validate() method name is obsolete; use verify()(   t   warningst   warnt   DeprecationWarning(   R   R    R#   (    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   validatee   s    	c         C   s~   d } t  | t i ƒ o t | ƒ } d } n t  | t i ƒ o t | ƒ } n |  i | | ƒ } | o t | ƒ S| Sd S(   so   blind(M : string|long, B : string|long) : string|long
        Blind message M using blinding factor B.
        i    i   N(   R   R   R   R   t   _blindR   (   R   R    t   BR   t   blindedmessage(    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   blindi   s     
  c         C   s~   d } t  | t i ƒ o t | ƒ } d } n t  | t i ƒ o t | ƒ } n |  i | | ƒ } | o t | ƒ S| Sd S(   ss   unblind(M : string|long, B : string|long) : string|long
        Unblind message M using blinding factor B.
        i    i   N(   R   R   R   R   t   _unblindR   (   R   R    R*   R   t   unblindedmessage(    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   unblindu   s     
  c         C   s   d S(   s  can_sign() : bool
        Return a Boolean value recording whether this algorithm can
        generate signatures.  (This does not imply that this
        particular key object has the private information required to
        to generate a signature.)
        i   (    (   R   (    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   can_sign…   s    c         C   s   d S(   sü   can_encrypt() : bool
        Return a Boolean value recording whether this algorithm can
        encrypt data.  (This does not imply that this
        particular key object has the private information required to
        to decrypt a message.)
        i   (    (   R   (    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   can_encryptŽ   s    c         C   s   d S(   sö   can_blind() : bool
        Return a Boolean value recording whether this algorithm can
        blind data.  (This does not imply that this
        particular key object has the private information required to
        to blind a message.)
        i    (    (   R   (    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt	   can_blind—   s    c         C   s   d S(   s`   size() : int
        Return the maximum number of bits that can be handled by this key.
        i    (    (   R   (    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   size£   s    c         C   s   d S(   sw   has_private() : bool
        Return a Boolean denoting whether the object contains
        private components.
        i    (    (   R   (    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyR   ©   s    c         C   s   |  S(   sd   publickey(): object
        Return a new key object containing only the public information.
        (    (   R   (    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt	   publickey°   s    c         C   s   |  i  ƒ  | i  ƒ  j S(   sF   __eq__(other): 0, 1
        Compare us to other for equality.
        (   R
   (   R   t   other(    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   __eq__¶   s    c         C   s   |  i  | ƒ S(   sH   __ne__(other): 0, 1
        Compare us to other for inequality.
        (   R6   (   R   R5   (    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   __ne__¼   s    (   t   __name__t
   __module__R   R
   R   R   R   R!   R$   R(   R,   R/   R0   R1   R2   R3   R   R4   R6   R7   (    (    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyR   !   s$   		
																		(    (   t   __revision__R   R%   t   Crypto.Util.numberR   (    (    (    sV   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\pubkey.pyt   <module>   s   
