Files
cms-website/.deps_siteforge_v812/itsdangerous/__pycache__/signer.cpython-312.pyc
T

92 lines
11 KiB
Plaintext
Raw Normal View History

Ë
êÅÙj¯%ãóÞ—ddlmZddlmZddlZddlZddlZddl m
Z
ddl m Z ddl m Z ddl m
Z
ddlmZGd „d
«ZGd „d e«Zddd
„ZGd„de«Z dd„ZGd„d«Zy)é)Ú annotationsNé)Ú_base64_alphabet)Ú
base64_decode)Ú
base64_encode)Ú
want_bytes)Ú BadSignaturecó —eZdZdZdd„Zdd„Zy)ÚSigningAlgorithmzgSubclasses must implement :meth:`get_signature` to provide
signature generation functionality.
có—t«‚)z2Returns the signature for the given key and value.)ÚNotImplementedError©ÚselfÚkeyÚvalues úWC:\Users\30997\AppData\Local\Temp\pip-target-6g32zz5s\lib\python\itsdangerous/signer.pyÚ
get_signaturezSigningAlgorithm.get_signatures €ä!Ó#Ð#ócóN—tj||j||««S)zMVerifies the given signature matches the expected
signature.
)ÚhmacÚcompare_digestr)rrrÚsigs rÚverify_signaturez!SigningAlgorithm.verify_signatures$€ô×"Ñ" 3¨×(:Ñ(:¸3ÀÓ(FÓGÐGrN©rÚbytesrrÚreturnr)rrrrrrrÚbool)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rr©rrr r s„ñó$ôHrr có—eZdZdZdd„Zy)Ú
NoneAlgorithmz`Provides an algorithm that does not perform any signing and
returns an empty signature.
có—y)Nrr"rs rrzNoneAlgorithm.get_signature$s€ØrNr)rrr r!rr"rrr$r$s „ñôrr$có,—tj|«S)zÈDon't access ``hashlib.sha1`` until runtime. FIPS builds may not include
SHA-1, in which case the import and use as a default would fail before the
developer can configure something else.
)ÚhashlibÚsha1)Ústrings rÚ
_lazy_sha1r*(s€ô
�<‰<˜Ó Ðrcó>—eZdZUdZee«Zded<ddd„Zd d„Z y)
Ú
HMACAlgorithmz*Provides signature generation using HMACs.út.AnyÚdefault_digest_methodNcó.—|€ |j}||_y©N)r.Ú
digest_method)rr1s rÚ__init__zHMACAlgorithm.__init__8s€Ø Ð Ø ×6Ñ6ˆMà$1ˆÕrcóf—tj|||j¬«}|j«S)N)ÚmsgÚ digestmod)rÚnewr1Údigest)rrrÚmacs rrzHMACAlgorithm.get_signature>s&€Ü�h‰h�s °×1CÑ1CÔDˆØ�z‰z‹|Ðrr0)r1r-r)
rrr r!Ú staticmethodr*r.Ú__annotations__r2rr"rrr,r,0s!…Ù4ñ
$0°
Ó#;И5Ó;ô2ô rr,có‚—t|ttf«r t|«gS|D�cgc]
}t|«‘Œc}Scc}wr0)Ú
isinstanceÚstrrr)Ú
secret_keyÚss rÚ_make_keys_listr@Cs<€ô�*œs¤E˜lÔ+ܘ:Ó&Ð'Ð'á#-Ó .¡:˜aŒJ�q�M :Ñ .Ð.ùÒ .s§<có¨—eZdZUdZee«Zded<dZded< d dd„Z e
dd „«Z ddd
„Z dd „Z
dd „Zdd
„Zdd„Zdd„Zy)ÚSigneraÖA signer securely signs bytes, then unsigns them to verify that
the value hasn't been changed.
The secret key should be a random string of ``bytes`` and should not
be saved to code or version control. Different salts should be used
to distinguish signing in different contexts. See :doc:`/concepts`
for information about the security of the secret key and salt.
:param secret_key: The secret key to sign and verify with. Can be a
list of keys, oldest to newest, to support key rotation.
:param salt: Extra key to combine with ``secret_key`` to distinguish
signatures in different contexts.
:param sep: Separator between the signature and value.
:param key_derivation: How to derive the signing key from the secret
key and salt. Possible values are ``concat``, ``django-concat``,
or ``hmac``. Defaults to :attr:`default_key_derivation`, which
defaults to ``django-concat``.
:param digest_method: Hash function to use when generating the HMAC
signature. Defaults to :attr:`default_digest_method`, which
defaults to :func:`hashlib.sha1`. Note that the security of the
hash alone doesn't apply when used intermediately in HMAC.
:param algorithm: A :class:`SigningAlgorithm` instance to use
instead of building a default :class:`HMACAlgorithm` with the
``digest_method``.
.. versionchanged:: 2.0
Added support for key rotation by passing a list to
``secret_key``.
.. versionchanged:: 0.18
``algorithm`` was added as an argument to the class constructor.
.. versionchanged:: 0.14
``key_derivation`` and ``digest_method`` were added as arguments
to the class constructor.
r-r.ú
django-concatr=Údefault_key_derivationNcó<—t|«|_t|«|_|jtvr t d«‚|� t|«}nd}||_|€ |j}||_|€ |j}||_
|€t|j«}||_ y)NzŠThe given separator cannot be used because it may be contained in the signature itself. ASCII letters, digits, and '-_=' must not be used.óitsdangerous.Signer)
r@Ú secret_keysrÚseprÚ
ValueErrorÚsaltrDÚkey_derivationr.r1r,Ú algorithm)rr>rJrHrKr1rLs rr2zSigner.__init__�s¨€ô)8¸
Ó(CˆÔÜ$ S›/ˆŒà �8‰8Ô'Ñ 'Üð7óð
ð РܘdÓ#‰Dà)ˆDàˆŒ à Ð !Ø!×8Ñ8ˆNà#1ˆÔà Ð Ø ×6Ñ6ˆMà$1ˆÔà Ð Ü% d×&8Ñ&8Ó9ˆIà+4ˆ�rcó —|jdS)z�The newest (last) entry in the :attr:`secret_keys` list. This
is for compatibility from before key rotation support was added.
éÿÿÿÿ)rG)rs rr>zSigner.secret_key¯s€ð
×Ñ Ñ#Ð#rcó|—|€|jd}n t|«}|jdk(rDtjt
|j
|j|z«j««S|jdk(rGtjt
|j
|jdz|z«j««S|jdk(rLtj||j ¬«}|j|j«|j«S|jdk(r|Std«‚) aüThis method is called to derive the key. The default key
derivation choices can be overridden here. Key derivation is not
intended to be used as a security method to make a complex key
out of a short password. Instead you should use large random
secret keys.
:param secret_key: A specific secret key to derive from.