✏️ 正在编辑: symmetric.cpython-312.pyc
路径:
/var/opt/nydus/ops/oscrypto/_openssl/__pycache__/symmetric.cpython-312.pyc
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
� ��'j�[ � �� � d dl mZmZmZmZ d dlZddlmZ ddlm Z m Z mZmZm Z mZ ddlmZmZmZmZ ddlmZ dd lmZmZ g d �Zd� Zd� Zd � Zd� Zd� Zd� Zd� Z d� Z!d� Z"d� Z#d� Z$d� Z%d� Z&d� Z'd� Z(d� Z)y)� )�unicode_literals�division�absolute_import�print_functionN� )�pretty_message)�new�null�is_null�buffer_from_bytes�bytes_from_buffer�deref� )� libcrypto�libcrypto_legacy_support�LibcryptoConst�handle_openssl_error)� rand_bytes)� type_name�byte_cls)�aes_cbc_no_padding_decrypt�aes_cbc_no_padding_encrypt�aes_cbc_pkcs7_decrypt�aes_cbc_pkcs7_encrypt�des_cbc_pkcs5_decrypt�des_cbc_pkcs5_encrypt�rc2_cbc_pkcs5_decrypt�rc2_cbc_pkcs5_encrypt�rc4_decrypt�rc4_encrypt�tripledes_cbc_pkcs5_decrypt�tripledes_cbc_pkcs5_encryptc � � t | � }|st d� }n,t |� dk7 rt t dt |� � � �t |� dz dk7 rt t dt |� � � �|t || ||d� fS )a� Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and no padding. This means the ciphertext must be an exact multiple of 16 bytes long. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The plaintext - a byte string :param iv: The initialization vector - either a byte string 16-bytes long or None to generate an IV :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are of the wrong type OSError - when an error is returned by OpenSSL :return: A tuple of two byte strings (iv, ciphertext) � �: iv must be 16 bytes long - is %s r zJ data must be a multiple of 16 bytes long - is %s F��_calculate_aes_cipherr �len� ValueErrorr �_encrypt��key�data�iv�ciphers �L/opt/nydus/tmp/pip-target-k0fmikie/lib/python/oscrypto/_openssl/symmetric.pyr r s� � �2 #�3� '�F� � ��^�� �R��B���� � ��G� � � � �4�y�2�~����� � ��I� � � � ����d�B��6�7�7� c � � t | � }t |� dk7 rt t dt |� � � �t || ||d� S )aM Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key and no padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector - a byte string 16-bytes long :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are of the wrong type OSError - when an error is returned by OpenSSL :return: A byte string of the plaintext r$ r% F�r'