File: //lib/python3.9/site-packages/S3/__pycache__/Crypto.cpython-39.pyc
a
��we|2 � @ s� d dl mZ d dlZd dlZzd dlmZ W n eyJ d dlmZ Y n0 ddlm Z d dl
mZ ddlm
Z
mZmZmZmZ dd lmZmZmZ dd
lmZ d dlZd dlmZmZ g Zd/d
d�Ze�d� dd� Ze�d� d0dd�Ze�d� dd� Z e�d� dd� Z!e�d� dd� Z"dd� Z#d1d d!�Z$e�d!� d defd"d#�Z%e�d$� d2d%d&�Z&e�d&� d3d'd(�Z'e�d(� d)d*� Z(e�d*� d+d,� Z)e�d,� d-d.� Z*e�d.� 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}t | �� �D ]X}|r6||vr6q$| | }|dv r`|dt|dd�|f 7 }q$|d|t| | dd�f 7 }q$|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.
� �=)Nr z&%s%sT��unicode_outputz&%s=%s�?r N)�sorted�keysr
)�params�always_have_equal�limited_keysZ param_strZ equal_str�key�value� r �-/usr/lib/python3.9/site-packages/S3/Crypto.py�format_param_str% s r! c C s, t � � j}tt�t|�| t��� ��� }|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"