관리-도구
편집 파일: rsa.cpython-311.pyc
� �܋fAU � �4 � d dl mZ d dlZd dlZd dlmZmZmZ d dlm Z d dl mZmZ d dl mZ d dlmZmZmZmZmZmZmZmZmZ d dlmZmZmZmZ ej rd d l m!Z! d/d�Z"d0d�Z#d1d�Z$d2d�Z%d3d#�Z&d4d&�Z'd5d+�Z(d6d,�Z) G d-� d%e� � Z* G d.� d(e� � Z+dS )7� )�annotationsN)�InvalidSignature�UnsupportedAlgorithm�_Reasons)�_calculate_digest_and_algorithm)�hashes� serialization)�utils) �MGF1�OAEP�PSS�AsymmetricPadding�PKCS1v15�_Auto� _DigestLength� _MaxLength�calculate_max_pss_salt_length)� RSAPrivateKey�RSAPrivateNumbers�RSAPublicKey�RSAPublicNumbers)�Backend�backendr �pssr �key�)typing.Union[RSAPrivateKey, RSAPublicKey]�hash_algorithm�hashes.HashAlgorithm�return�intc � � |j }t |t � � rt ||� � S t |t � � r|j S t |t � � r0t |t � � rt d� � �| j j S |S )Nz6PSS salt length can only be set to AUTO when verifying)�_salt_length� isinstancer r r �digest_sizer r � ValueError�_lib�RSA_PSS_SALTLEN_AUTO)r r r r �salts �{/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/cryptography/hazmat/backends/openssl/rsa.py�_get_rsa_pss_salt_lengthr* * s� � � ��D��$� �#�#� �,�S�.�A�A�A� �D�-� (� (� ��)�)� �D�%� � � ��c�=�)�)� ��H�� � � �|�0�0��� �+typing.Union[_RSAPrivateKey, _RSAPublicKey]�data�bytes�paddingr c � � t |t � � st d� � �t |t � � r | j j }n�t |t � � rp| j j }t |j t � � st dt j � � �| � |� � st dt j � � �n"t |j � d�t j � � �t! | ||||� � S )Nz1Padding must be an instance of AsymmetricPadding.�'Only MGF1 is supported by this backend.zPThis combination of padding and hash algorithm is not supported by this backend.�" is not supported by this backend.)r# r � TypeErrorr r&