PHP WebShell

Текущая директория: /usr/lib/python3/dist-packages/cryptography/hazmat/primitives/serialization/__pycache__

Просмотр файла: pkcs7.cpython-310.pyc

o

g�ev�@s�ddlZddlmZddlmZddlmZddlmZmZddl	m
Z
mZddlm
Z
ded	ejejfd
d�Zded	ejejfdd
�ZejejejejejejfZejeje
jfZGdd�dej�ZGdd�de�Z dS)�N)�utils)�x509)�_get_backend)�hashes�
serialization)�ec�rsa)�_check_byteslike�data�returncC�td�}|�|�S�N)r�load_pem_pkcs7_certificates�r
�backend�r�T/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/serialization/pkcs7.pyr�
rcCrr
)r�load_der_pkcs7_certificatesrrrrrrrc@s$eZdZdZdZdZdZdZdZdS)�PKCS7OptionszAdd text/plain MIME typez5Don't translate input data into canonical MIME formatz'Don't embed data in the PKCS7 structurezDon't embed SMIME capabilitiesz#Don't embed authenticatedAttributeszDon't embed signer certificateN)	�__name__�
__module__�__qualname__�Text�Binary�DetachedSignature�NoCapabilities�NoAttributes�NoCertsrrrrr&src@s�eZdZdggfdd�Zdeddfdd�Zdejd	ed
e	ddfdd�Z
dejddfd
d�Z	ddej
dejedefdd�ZdS)�PKCS7SignatureBuilderNcCs||_||_||_dSr
)�_data�_signers�_additional_certs)�selfr
�signers�additional_certsrrr�__init__0s
zPKCS7SignatureBuilder.__init__r
rcCs(td|�|jdurtd��t||j�S)Nr
zdata may only be set once)r	r �
ValueErrorrr!)r#r
rrr�set_data5s

zPKCS7SignatureBuilder.set_data�certificate�private_key�hash_algorithmcCsnt|tjtjtjtjtjf�std��t|tj	�std��t|t
jtj
f�s*td��t|j|j|||fg�S)NzLhash_algorithm must be one of hashes.SHA1, SHA224, SHA256, SHA384, or SHA512�&certificate must be a x509.Certificatez.Only RSA & EC keys are supported at this time.)�
isinstancer�SHA1�SHA224�SHA256�SHA384�SHA512�	TypeErrorr�Certificater�
RSAPrivateKeyr�EllipticCurvePrivateKeyrr r!)r#r)r*r+rrr�
add_signer<s,��
���z PKCS7SignatureBuilder.add_signercCs,t|tj�s
td��t|j|j|j|g�S)Nr,)r-rr4r3rr r!r")r#r)rrr�add_certificate]s
�z%PKCS7SignatureBuilder.add_certificate�encoding�optionscCs�t|j�dkrtd��|jdurtd��t|�}tdd�|D��s%td��|tjjtjj	tjj
fvr6td��tj|vrDtj
|vrDtd��tj|vrW|tjj	tjjfvrWtd	��tj|vretj|vretd
��t|�}|�|||�S)NrzMust have at least one signerzYou must add data to signcss�|]}t|t�VqdSr
)r-r)�.0�xrrr�	<genexpr>rs�z-PKCS7SignatureBuilder.sign.<locals>.<genexpr>z*options must be from the PKCS7Options enumz1Must be PEM, DER, or SMIME from the Encoding enumzAWhen passing the Text option you must also pass DetachedSignaturez9The Text option is only available for SMIME serializationzFNoAttributes is a superset of NoCapabilities. Do not pass both values.)�lenr!r'r �list�allr�Encoding�PEM�DER�SMIMErrrrrr�
pkcs7_sign)r#r9r:rrrr�signgsD
��

���

�zPKCS7SignatureBuilder.signr
)rrrr&�bytesr(rr4�_ALLOWED_PRIVATE_KEY_TYPES�_ALLOWED_PKCS7_HASH_TYPESr7r8rrA�typing�IterablerrFrrrrr/s2���
�!�
�����r)!rJ�cryptographyrr�cryptography.hazmat.backendsr�cryptography.hazmat.primitivesrr�)cryptography.hazmat.primitives.asymmetricrr�cryptography.utilsr	rG�Listr4rr�Unionr.r/r0r1r2rIr5r6rH�Enumr�objectrrrrr�<module>s,��
�	

Выполнить команду


Для локальной разработки. Не используйте в интернете!