File: //lib/python3.6/site-packages/S3/__pycache__/Crypto.cpython-36.pyc
3
��we|2 � @ s� d dl mZ d dlZd dlZyd dlmZ W n ek
rL d dlmZ Y nX ddlm Z d dl
mZ ddlm
Z
mZmZmZmZ dd lmZmZmZ dd
lmZ d dlZd dlmZmZ g Zd/d
d�Zejd� dd� Zejd� d0dd�Zejd� dd� Z ejd� dd� Z!ejd� dd� Z"dd� Z#d1d d!�Z$ejd!� d defd"d#�Z%ejd$� d2d%d&�Z&ejd&� d3d'd(�Z'ejd(� d)d*� Z(ejd*� d+d,� Z)ejd,� d-d.� Z*ejd.� dS )4� )�absolute_importN)�encodebytes)�encodestring� )�Config)�debug)�encode_to_s3�decode_from_s3�s3_quote�md5�unicode)�
time_to_epoch�deunicodise�check_bucket_name_dns_support)�
SortedDict)�sha1�sha256Fc C s� | sdS d}|rdpd}xht | j� �D ]X}|r8||kr8q&| | }|d
krb|dt|dd�|f 7 }q&|d|t| | dd�f 7 }q&W |o�d|d d� S )a�
Format URL parameters from a params dict and returns
?parm1=val1&parm2=val2 or an empty string if there
are no parameters. Output of this function should
be appended directly to self.resource['uri']
- Set "always_have_equal" to always have the "=" char for a param even when
there is no value for it.
- Set "limited_keys" list to restrict the param string to keys that are
defined in it.
� �=Nz&%s%sT)�unicode_outputz&%s=%s�?r )Nr )�sorted�keysr
)�params�always_have_equal�limited_keysZ param_strZ equal_str�key�value� r �/usr/lib/python3.6/Crypto.py�format_param_str% s r c C s, t j � j}ttjt|�| t�j� �j� }|S )a{ Sign a string with the secret key, returning base64 encoded results.
By default the configured secret key is used, but may be overridden as
an argument.
Useful for REST authentication. See http://s3.amazonaws.com/doc/s3-developer-guide/RESTAuthentication.html
string_to_sign should be utf-8 "bytes".
and returned signature will be utf-8 encoded "bytes".
) r �
secret_keyr �hmac�newr r �digest�strip)�string_to_signr! � signaturer r r �sign_string_v2B s
r( �GET�/c C sZ ddddddddd d
ddd
ddddddg}|dkr<t dd�}tj� j}| d }||jdd�d 7 }||jdd�d 7 }||jdd�d 7 }xXt|j� �D ]H}|jd�r�||d || d 7 }|jd�r�||d || d 7 }q�W t|ddd �}t||d!�}||7 }||7 }t d"t
|� � ttt
|���} t t|j� �dd�}
d#| d | |
d$<